php,datetime,timezone,datetime-conversion
Use method DateTime::setTimeZone(): date_default_timezone_set('Europe/London'); $date = new DateTime('2015-02-14 19:30:00'); print_r($date); echo("Local time in London: ".$date->format('Y-m-d H:i:s')."\n"); $date->setTimeZone(new DateTimeZone('Europe/Amsterdam')); print_r($date); echo("Local time in Amsterdam: ".$date->format('Y-m-d H:i:s')."\n"); The output of the script above: DateTime Object ( [date] => 2015-02-14 19:30:00.000000 [timezone_type] => 3 [timezone] => Europe/London ) Local time in London: 2015-02-14...
c#,datetime,timezone,datetime-conversion
From this link; !!! Note: Currently FLE Summer Time is observed. And this says it is UTC+3 currently. That's why it's too normal to get 3 hour differences when you calculate them. As Hans Passanst says, when you write Google as Local time in Kyiv or Local time in Riga,...
c#,asp.net,sql-server,datetime,datetime-conversion
Since there's no meaningful value to their difference if any of them is null, you only need to concern yourself with the case where they're not: DateTime? arrival = (DateTime?)(t.ArrivalDate.Value); DateTime? departure = (DateTime?)(t.DepartureDate); double? totalDays = arrival.HasValue && departure.HasValue ? (double?)(departure - arrival).GetValueOrDefault().TotalDays : null; The subtraction should work...
c#,timezone,dst,datetime-conversion
A couple of things: The ID "Eastern Standard Time" represents both EST and EDT, with the appropriate transitions in place. It would more appropriately be called "Eastern Time", but alas this is the identifier and the convention used by Windows time zones. The Eastern Time zone really does transition in...
mysql,datetime,timezone,unix-timestamp,datetime-conversion
You ran this time-diagnostic query on your MySQL server. select @@time_zone, now(), utc_timestamp() It's clear from your local time and utc time that your server machine's system time zone setting is 'Canada/Mountain', and the MySQL server software doesn't have its own timezone setting. If you pick up your tables and...
sql,vbscript,datetime-conversion
Fix the discrepancy between tid and tiden See if feeding a m/d/y string - trim (arrString (2)) & "/" & trim (arrString (1)) & "/" & trim (arrString (3)) 'works' If (2) fails or you don't want a hack, try to concat a date literal "#m/d/y#" into your SQL...
ios,objective-c,nsdate,datetime-conversion
Try converting to the local date from UTC NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"]; NSDate *date = [dateFormatter dateFromString:timestamp]; NSTimeZone *currentTimeZone = [NSTimeZone localTimeZone]; NSTimeZone *previousTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"]; NSInteger currentGMTOffset = [currentTimeZone secondsFromGMTForDate:date]; NSInteger currentOffset = [previousTimeZone secondsFromGMTForDate:date]; NSTimeInterval gmtInterval =...
windows,datetime,batch-file,datetime-conversion,julian-date
@ECHO OFF SETLOCAL FOR %%y IN (2000 2001 2012 2013 2014 2015 2016) DO ( FOR %%d IN ( 01/01/%%y 02/01/%%y 02/28/%%y 02/29/%%y 03/01/%%y 04/01/%%y 05/01/%%y 06/01/%%y 07/01/%%y 08/01/%%y 09/01/%%y 10/01/%%y 11/01/%%y 12/01/%%y 12/31/%%y ) DO CALL :julian %%d ) GOTO :EOF :julian SET jdate=%1 SET /a yyyy=%jdate:~-4%&SET /a mm=1%jdate:~0,2%&SET...
c#,sql-server,datetime,datetime-conversion
Basically, you shouldn't be converting the values to strings and back in the first place. Wherever possible, avoid string conversions unless that's an essential part of what you're trying to do. In your case, you're really interested in DateTime values. They're DateTime in the database, and you want them as...