Welcome Guest, Not a member yet? Register   Sign In
How to get entries from DB depending on timezone?
#12

[eluser]Jelmer[/eluser]
The endresult of strtotime() is the amount of seconds since (or before) January 1st 1970 GMT, which you might consider in GMT but in reality has no timezone. That's the advantage of using UNIX timestamps because all dates are saved in a format that doesn't care about timezones or dates.

Because it's a simple int you can make whatever selection you want between two points in time you want. If you look at my previous example you'll see that this selects the EST:
Code:
$start_date = strtotime('2010-04-12 00:00:00 -0500');
$end_date = strtotime('2010-04-12 23:59:59 -0500');
Which would get the exact same timestamps as this one (same moment in time but in the GMT timezone):
Code:
$start_date = strtotime('2010-04-12 05:00:00 0000');
$end_date = strtotime('2010-04-13 04:59:59 0000');

Both these examples will return:
Code:
$start_date == 1271048400;
$end_date == 1271134799


Messages In This Thread
How to get entries from DB depending on timezone? - by El Forum - 04-10-2010, 06:35 AM
How to get entries from DB depending on timezone? - by El Forum - 04-10-2010, 07:26 AM
How to get entries from DB depending on timezone? - by El Forum - 04-10-2010, 11:01 AM
How to get entries from DB depending on timezone? - by El Forum - 04-12-2010, 12:24 PM
How to get entries from DB depending on timezone? - by El Forum - 04-12-2010, 02:49 PM
How to get entries from DB depending on timezone? - by El Forum - 04-12-2010, 02:53 PM
How to get entries from DB depending on timezone? - by El Forum - 04-12-2010, 02:58 PM
How to get entries from DB depending on timezone? - by El Forum - 04-12-2010, 03:28 PM
How to get entries from DB depending on timezone? - by El Forum - 04-12-2010, 03:53 PM
How to get entries from DB depending on timezone? - by El Forum - 04-12-2010, 04:12 PM
How to get entries from DB depending on timezone? - by El Forum - 04-15-2010, 10:20 AM
How to get entries from DB depending on timezone? - by El Forum - 04-15-2010, 11:39 AM
How to get entries from DB depending on timezone? - by El Forum - 04-15-2010, 11:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB