DateTime vs DateTimeOffset

DateTimeOffset is a representation of instantaneous time (also known as absolute time). By that, I mean a moment in time that is universal for everyone (not accounting for leap seconds, or the relativistic effects of time dilation). Another way to represent instantaneous time is with a DateTime where .Kind is DateTimeKind.Utc. This is distinct from … Read more

How do I set the time zone of MySQL?

I thought this might be useful: There are three places where the timezone might be set in MySQL: In the file “my.cnf” in the [mysqld] section default-time-zone=”+00:00″ @@global.time_zone variable To see what value they are set to: SELECT @@global.time_zone; To set a value for it use either one: SET GLOBAL time_zone=”+8:00″; SET GLOBAL time_zone=”Europe/Helsinki”; SET … Read more

Convert date to another timezone in JavaScript

Here is the one-liner: function convertTZ(date, tzString) { return new Date((typeof date === “string” ? new Date(date) : date).toLocaleString(“en-US”, {timeZone: tzString})); } // usage: Asia/Jakarta is GMT+7 convertTZ(“2012/04/20 10:10:30 +0000”, “Asia/Jakarta”) // Tue Apr 20 2012 17:10:30 GMT+0700 (Western Indonesia Time) // Resulting value is regular Date() object const convertedDate = convertTZ(“2012/04/20 10:10:30 +0000”, “Asia/Jakarta”) … Read more

How to get a time zone from a location using latitude and longitude coordinates?

Time Zone Location Web Services Google Maps Time Zone API Bing Maps Time Zone API Azure Maps Time Zone API GeoNames Time Zone API TimeZoneDB API AskGeo – commercial (but arguably more accurate than GeoNames) GeoGarage Time Zone API – commercial, focusing on Nautical time zones. Raw Time Zone Boundary Data Timezone Boundary Builder – … Read more