Answer

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.

  • 15
Reply Report
      • 2
    • DateTime is the future. +1. Note that you need PHP 5.3 to enjoy some of the DateTime goodness (Intervals, CreateFromFormat and such). If in doubt, the manual will tell you the required version
      • 1
    • DateTime cannot go before 1901 in all case. $date = new DateTime('1869-01-01 07:00:00'); echo $date->format('U'); << This works. $date->setTimestamp(-3187208524); echo $date->format('Y-m-d H:i:s'); << This does not work!
    • @vee works here (5.5.9). Maybe you're using a 32-bit build of PHP? Try passing the timestamp as a float instead (-3187208524.).

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions