Strtotime在php中无法正常工作 [英] Strtotime in php not working

查看:56
本文介绍了Strtotime在php中无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





php中的strtotime函数无法正常工作。



i我正在使用类似这样的代码





date(Ymd ,strtotime($ datevar));





它在最近的日期工作正常,但没有像2060年或1900年那样工作等。



是什么原因?



由于旧版本的php,最新的PHP日期方法在godaddy中无效。





我想把它插入mysql db



谢谢



strtotime function in php is not working properly.

i am using code something like this


date("Y-m-d", strtotime($datevar));


it is working properly for recent dates but not working for years like 2060 or 1900 etc.

what is the reason?

Latest PHP date methods are not working in godaddy because of old version of php.


I want to insert it into mysql db

Thanks

推荐答案

datevar));





它适用于最近日期但不能像2060年或1900年那样工作等。



是什么原因?



由于旧版本的php,最新的PHP日期方法在godaddy中无效。





我想把它插入mysql db



谢谢
datevar));


it is working properly for recent dates but not working for years like 2060 or 1900 etc.

what is the reason?

Latest PHP date methods are not working in godaddy because of old version of php.


I want to insert it into mysql db

Thanks


来自PHP.NET文档:

时间戳的有效范围通常是从格林威治标准时间1901年12月13日20:45:54到1月19日星期二2038 03:14:07 GMT。(这些是与32位有符号整数的最小值和最大值相对应的日期。)但是,在PHP 5.1.0之前,此范围仅限于01-01-1970到19-某些系统(例如Windows)上的01-2038。



使用'date(Ymd,strtotime(
From PHP.NET documentation:
"The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer). However, before PHP 5.1.0 this range was limited from 01-01-1970 to 19-01-2038 on some systems (e.g. Windows)."

Use instead 'date("Y-m-d", strtotime(


datevar));':

datevar));':


这篇关于Strtotime在php中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆