沃梦达 / 编程问答 / php问题 / 正文

1970 年之前(甚至 1700 年之前)的 Unix 时间戳,使用 PHP

Unix timestamp before 1970 (even before 1700), using PHP(1970 年之前(甚至 1700 年之前)的 Unix 时间戳,使用 PHP)

本文介绍了1970 年之前(甚至 1700 年之前)的 Unix 时间戳,使用 PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何处理 01.01.1970 之前的日期?

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.

我怎样才能做到这一点?

how can i achieve that?

提前谢谢你!

推荐答案

你可以使用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.

这篇关于1970 年之前(甚至 1700 年之前)的 Unix 时间戳,使用 PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:1970 年之前(甚至 1700 年之前)的 Unix 时间戳,使用 PHP

基础教程推荐