I'm looking to get the current date and time in a UNIX timestamp so I do some calculations but I am not getting the correct time. The date is correct but the time is off. I've already set my timezone so I'm lost on this. Can someone lend a hand?
Thanks.
Here is some of the code I am using:
date_default_timezone_set('America/Los_Angeles');
echo time();
Outputs: 1256926663 which is equal to Fri, 30 Oct 2009 18:17:43 GMT.
This is incorrect. What it should be is: Fri, 30 Oct 2009 10:17:43 PST
OK, the issue is not with the timestamp as I thought. I am using MySQL to interpret the timestamp but it is not correct. Here is what I am using:
FROM_UNIXTIME(timestamp, '%M %D, %Y - %l:%i %p') AS timestamp