Does .NET have the history of time zone changes?

.NET tracks some history, but it is not always accurate. You’ve stumbled upon one of the inaccuracies. .NET imports all of it’s time zone information from Windows via the registry, as described here and here. If you look in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Russian Standard Time\Dynamic DST you’ll find that it only tracks information … Read more

How to get Unix timestamp in php based on timezone

The answer provided by Volkerk (that says timestamps are meant to be always UTC based) is correct, but if you really need a workaround (to make timezone based timestamps) look at my example. <?php //default timezone $date = new DateTime(null); echo ‘Default timezone: ‘.$date->getTimestamp().'<br />’.”\r\n”; //America/New_York $date = new DateTime(null, new DateTimeZone(‘America/New_York’)); echo ‘America/New_York: ‘.$date->getTimestamp().'<br … Read more

What is the default timezone in java.util.Date

The date itself doesn’t have any time zone. Its toString() method uses the current default time zone to return a String representing this date: Date date = new Date(); System.out.println(TimeZone.getDefault()); System.out.println(date); TimeZone.setDefault(TimeZone.getTimeZone(“UTC”)); System.out.println(TimeZone.getDefault()); System.out.println(date); Executing the above code on my machine leads to the following output: sun.util.calendar.ZoneInfo[id=”Europe/Paris”,offset=3600000,dstSavings=3600000,useDaylight=true,transitions=184,lastRule=java.util.SimpleTimeZone[id=Europe/Paris,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]] Fri Jul 06 09:24:45 CEST 2012 sun.util.calendar.ZoneInfo[id=”UTC”,offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null] Fri … Read more