strtotime problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

strtotime problem

Post by s.dot »

Code: Select all

$time = 'May 20 at 6:39 AM';
echo strtotime($time);
echo '<br />';
echo strtotime($time,time());
Both of these give me a timestamp that is exactly two hours behind what it should be. The timestamp returned is at 4:39 AM.

Am I doing something wrong?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
aerodromoi
Forum Contributor
Posts: 230
Joined: Sun May 07, 2006 5:21 am

Re: strtotime problem

Post by aerodromoi »

scottayy wrote:

Code: Select all

$time = 'May 20 at 6:39 AM';
echo strtotime($time);
echo '<br />';
echo strtotime($time,time());
Both of these give me a timestamp that is exactly two hours behind what it should be. The timestamp returned is at 4:39 AM.

Am I doing something wrong?
Perhaps a timezone issue. What does it say for

Code: Select all

strtotime("now");
?

aerodromoi
User avatar
xpgeek
Forum Contributor
Posts: 146
Joined: Mon May 22, 2006 1:45 am
Location: Kyiv, Ukraine
Contact:

Re: strtotime problem

Post by xpgeek »

scottayy wrote:

Code: Select all

$time = 'May 20 at 6:39 AM';
echo strtotime($time);
echo '<br />';
echo strtotime($time,time());
Both of these give me a timestamp that is exactly two hours behind what it should be. The timestamp returned is at 4:39 AM.

Am I doing something wrong?
result of strtotime get in GMT format
Post Reply