By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,061 Members | 1,515 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,061 IT Pros & Developers. It's quick & easy.

strtotime a2038

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.