Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unix timestamp before 1970 (even before 1700), using PHP

Tags:

php

timestamp

how can i work with dates before 01.01.1970?

i need to get first day of the month for dates from year 1700.

how can i achieve that?

thank you in advance!

like image 717
user198003 Avatar asked Nov 20 '10 10:11

user198003


1 Answers

You can use DateTime.

Example:

<?php
$d = new DateTime("1780-06-01");
echo $d->format("l"); //Thursday

You should, however, consider that the Gregorian Calendar was adopted in different instants throughout the world.

like image 153
Artefacto Avatar answered Nov 15 '22 15:11

Artefacto