tagged [utc]

Why does DateTime.Now.ToString("u") not work?

Why does DateTime.Now.ToString("u") not work? I am currently in [British summer time](http://www.timeanddate.com/library/abbreviations/timezones/eu/bst.html) which is UTC +1 Hour. I confirmed my PC is...

24 Jul at 12:35

How do I get a UTC Timestamp in JavaScript?

How do I get a UTC Timestamp in JavaScript? While writing a web application, it makes sense to store (server side) datetimes in the DB as UTC timestamps. I was astonished when I noticed that you could...

30 Aug at 18:59

Converting datetime.date to UTC timestamp in Python

Converting datetime.date to UTC timestamp in Python I am dealing with dates in Python and I need to convert them to UTC timestamps to be used inside Javascript. The following code does not work: Conve...

17 Jul at 09:13

JSON Stringify changes time of date because of UTC

JSON Stringify changes time of date because of UTC My date objects in JavaScript are always represented by UTC +2 because of where I am located. Hence like this Problem is doing a `JSON.stringify` con...

3 Dec at 10:41

Convert UTC Epoch to local date

Convert UTC Epoch to local date I have been fighting with this for a bit now. I’m trying to convert epoch to a date object. The epoch is sent to me in UTC. Whenever you pass `new Date()` an epoch, it ...

24 Oct at 10:23

Daylight saving time and time zone best practices

Daylight saving time and time zone best practices I am hoping to make this question and the answers to it the definitive guide to dealing with daylight saving time, in particular for dealing with the ...

Convert UTC/GMT time to local time

Convert UTC/GMT time to local time We are developing a C# application for a web-service client. This will run on Windows XP PC's. One of the fields returned by the web service is a DateTime field. The...

6 Jan at 07:53

Are .Net's DateTime methods capable of recognising a Leap Second?

Are .Net's DateTime methods capable of recognising a Leap Second? With a [Leap Second on the horizon for June this year](ftp://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat) it got me wondering whether ...

6 Jan at 16:18

Is there an OrmLite option for DateTime.SpecifyKind(DateTimeKind.Utc)?

Is there an OrmLite option for DateTime.SpecifyKind(DateTimeKind.Utc)? Is there a way to specify that I want of the `DateTime`s that OrmLite materializes to be set to UTC kind? I store a lot of `DateT...

23 May at 12:6

Get current date time from server and convert it into local time in c#

Get current date time from server and convert it into local time in c# Help: I have a server which is having time in GMT-07.00 hours. My local time is GMT+05.30 hours. I need to get current date and t...

9 Mar at 07:26

Globally convert UTC DateTimes to user specified local DateTimes

Globally convert UTC DateTimes to user specified local DateTimes I am storing all the DateTime fields as UTC time. When a user requests a web page, I would like to take his preferred local timezone (a...

2 May at 19:6

Get DateTime as UTC with Dapper

Get DateTime as UTC with Dapper I'm using Dapper to map my entities to SQL Server CE. If I save a `DateTime` with `Kind=Utc`, when I read it back I get a `DateTime` with `Kind=Unspecified`, which lead...

20 Sep at 14:35

How to convert DateTime in Specific timezone?

How to convert DateTime in Specific timezone? I find it hard to understand how UTC works. I have to do the following but I'm still confused if I'd get the right result. Objectives: 1. Ensure all sa...

26 Mar at 09:27

Storing date/times as UTC in database

Storing date/times as UTC in database I am storing date/times in the database as UTC and computing them inside my application back to local time based on the specific timezone. Say for example I have ...

7 Jan at 17:13

How can I determine a timezone by the UTC offset?

How can I determine a timezone by the UTC offset? I have a scenario where I have a timezone offset (in minutes) and need to determine the timezone for it. I know that all the data is not available (fo...

14 Aug at 12:32

Where's the DateTime 'Z' format specifier?

Where's the DateTime 'Z' format specifier? [: ] I've been trying to perform roundtrip DateTime conversions with a format string that uses 'zzz' format specifier, which I know is bound to local time. S...

7 May at 06:38

Issue around utc date - TimeZoneInfo.ConvertTimeToUtc results in date change

Issue around utc date - TimeZoneInfo.ConvertTimeToUtc results in date change Having an issue whereby the date I wish to save is changing from the onscreen selected date if the users selects a timezone...

18 Mar at 10:14

Timezone Strategy

Timezone Strategy I am building a MVC 3 application where the users may not be in the same time zone, so my intent was to store everything in UTC and convert from UTC to local time in the views and lo...

How to convert a date to UTC properly and then convert it back?

How to convert a date to UTC properly and then convert it back? I'm struggling with converting DateTime to UTC, the concept and all, something I'm not understanding correctly. When I get a date time s...

19 Feb at 21:14