473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

strtotime a2038

So, after doing some research I finally figured that php chokes on
dates past year 2525. In this web service that I use they often use
2525-05-31 as the expiration date. I want to determine how I can
convert this in a format to compare it with other dates.

Before I was trying this:

if (strtotime($territory->expirationDate) < strtotime("2008-01-01")){
/do something
}

but since $territory->expirationDate really equals 2525-05-31 it was
not working...

What is a nice clean way to solve this problem?
Jan 7 '08 #1
3 1954
Anthony Smith schreef:
So, after doing some research I finally figured that php chokes on
dates past year 2525. In this web service that I use they often use
2525-05-31 as the expiration date. I want to determine how I can
convert this in a format to compare it with other dates.

Before I was trying this:

if (strtotime($territory->expirationDate) < strtotime("2008-01-01")){
/do something
}

but since $territory->expirationDate really equals 2525-05-31 it was
not working...

What is a nice clean way to solve this problem?
You could simply do:

if (strtotime($territory->expirationDate) >= 2038) {
// do something
}
JW
Jan 8 '08 #2
On Jan 8, 5:08 am, Janwillem Borleffs <j...@jwscripts.comwrote:
Anthony Smith schreef:
So, after doing some research I finally figured that php chokes on
dates past year 2525. In this web service that I use they often use
2525-05-31 as the expiration date. I want to determine how I can
convert this in a format to compare it with other dates.
Before I was trying this:
if (strtotime($territory->expirationDate) < strtotime("2008-01-01")){
/do something
}
but since $territory->expirationDate really equals 2525-05-31 it was
not working...
What is a nice clean way to solve this problem?

You could simply do:

if (strtotime($territory->expirationDate) >= 2038) {
// do something

}

JW
But I need to compare the entire date. They could be the same year.
Jan 8 '08 #3
Anthony Smith schreef:
But I need to compare the entire date. They could be the same year.
Beyond 2038? When this is the case, you could make sure that both dates
have the same format (YYYYMMDD, with date('Ymd', $time) and/or
str_replace('-', '', $datestring)) and compare that.
JW
Jan 9 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Pjotr Wedersteers | last post by:
I'm using strtotime to get the timestamp for midnight. I have a statistics script for my pagecounter that displays hits since midnight. I also display the number of hours and minutes passed since...
1
by: peabody | last post by:
I'm trying to use the strtotime() function to manage sessions. But I get the following <?php print(time() . " - " . strtotime("+1 hour")); ?> outputs: 1097380666 - 1097308800
5
by: Leif K-Brooks | last post by:
PHP has a very nice strtotime function (http://php.net/strtotime) which converts a date/time in virtually any format into a timestamp. Does Python have a similar function?
7
by: Rithish | last post by:
Hello. I noticed a strange thing while using strtotime() and date() functions in combination to generate from MySQL into a readable format. By default, the MySQL date field will be 0000-00-00...
18
by: windandwaves | last post by:
Hi Folk I love the strtotime function, because I can make a date field in a form and just tell my users to enter whatever they want and as long as it is a date, it will work. HOWEVER, this...
6
by: Brian Kendig | last post by:
I'm working with dates in several formats including 'yyyy MMM dd', but strtotime doesn't recognize this format and returns FALSE. Is there a direct way to convert times from this format into...
5
by: cla | last post by:
I'm using this code on an application to track football schedules: ---- $season = '2005'; $basedate = strtotime('this friday', strtotime('31 August '.$season)); for($d=0;$d<=31;$d++) {...
5
by: Chris | last post by:
I am trying to output Monday of the current week i.e. if Monday is the 8th I want to display 'Monday 8th' for any date between Monday 8-14th. I would appreciate any help, the code below is...
9
by: Erwin Moller | last post by:
Hi group, I have been using strtotime a lot in my code. I wonder if I made a mistake in my thinking. :-/ Here follows a stripped down example. consider some dates: $date1 = "2008-02-23";...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.