本文介绍了使用PHP的1970年之前(甚至1700年之前)的Unix时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何处理1970年1月1日之前的日期?
how can i work with dates before 01.01.1970?
从1700年开始,我需要获取每月的第一天.
i need to get first day of the month for dates from year 1700.
我该如何实现?
先谢谢您!
推荐答案
您可以使用 DateTime
.
You can use DateTime
.
示例:
<?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.
这篇关于使用PHP的1970年之前(甚至1700年之前)的Unix时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!