Questions tagged [utc]

UTC stands for Coordinated Universal Time - it is the time standard by which the world regulates clocks and time.

UTC stands for Coordinated Universal Time - it is the time standard by which the world regulates clocks and time.

Questions relating to UTC can relate to date-time formatting, conversions etc.

Definition taken from - WikiPedia

2332 questions
83
votes
8 answers

Where's the DateTime 'Z' format specifier?

[Update: Format specifiers are not the same thing as format strings; a format specifier is a piece of a custom format string, where a format string is 'stock' and doesn't provide customization. My problem is with specifiers not formats] I've been…
Daniel Crenna
  • 3,326
  • 1
  • 24
  • 34
83
votes
1 answer

Android get Current UTC time

What is the function to get the current UTC time. I have tried with System.getCurrentTime but i get the current date and time of the device. Thanks
Gerardo
  • 5,800
  • 11
  • 66
  • 94
81
votes
3 answers

Is there a difference between the UTC and Etc/UTC time zones?

In the PHP documentation, list of supported time zones, UTC is listed twice: UTC Etc/UTC Is there any conceptual difference between those two, or are they just synonyms?
BenMorel
  • 34,448
  • 50
  • 182
  • 322
80
votes
3 answers

Objective-C setting NSDate to current UTC

Is there an easy way to init an NSDate with the current UTC date/time?
Brodie
  • 3,526
  • 8
  • 42
  • 61
78
votes
12 answers

SQL Server - Convert date field to UTC

I have recently updated my system to record date/times as UTC as previously they were storing as local time. I now need to convert all the local stored date/times to UTC. I was wondering if there is any built in function, similar to .NET's…
James
  • 80,725
  • 18
  • 167
  • 237
76
votes
6 answers

How do I get the UTC time of "midnight" for a given timezone?

The best I can come up with for now is this monstrosity: >>> datetime.utcnow() \ ... .replace(tzinfo=pytz.UTC) \ ... .astimezone(pytz.timezone("Australia/Melbourne")) \ ... .replace(hour=0,minute=0,second=0,microsecond=0) \ ... …
Tom
  • 42,844
  • 35
  • 95
  • 101
75
votes
8 answers

Convert UTC into Local Time on Android

In my project, I have get the API response in json format. I get a string value of time in UTC time format like this Jul 16, 2013 12:08:59 AM. I need to change this into Local time. That is where ever we use this the app needs to show the local…
MadTech
  • 1,458
  • 3
  • 13
  • 32
74
votes
4 answers

pytz localize vs datetime replace

I'm having some weird issues with pytz's .localize() function. Sometimes it wouldn't make adjustments to the localized datetime: .localize behaviour: >>> tz >>> d datetime.datetime(2009, 9, 2,…
Art
  • 23,747
  • 29
  • 89
  • 101
72
votes
9 answers

Getting computer's UTC offset in Python

In Python, how do you find what UTC time offset the computer is set to?
Paul
  • 4,239
  • 6
  • 28
  • 29
72
votes
4 answers

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 leads to all kind of problems. Example: var f = new Foo { Id = 42, ModificationDate =…
Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758
71
votes
3 answers

MySQL Workbench: how do I set up "ON UPDATE" and CURRENT_TIMESTAMP?

SEE: Update timestamp column in Application or Database? I'm trying to model something similar in Workbench, but I don't know where to set the "ON UPDATE" part. The best I can get is the following: --…
StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441
71
votes
4 answers

How does DateTime.ToUniversalTime() work?

How does the conversion to UTC from the standard DateTime format work? More specifically, if I create a DateTime object in one time zone and then switch to another time zone and run ToUniversalTime() on it, how does it know the conversion was done…
derGral
  • 1,836
  • 4
  • 19
  • 29
71
votes
5 answers

DateTime.Parse("2012-09-30T23:00:00.0000000Z") always converts to DateTimeKind.Local

I want to parse a string that represent a DateTime in UTC format. My string representation includes the Zulu time specification which should indicate that the string represent a UTC time. var myDate = DateTime.Parse("2012-09-30T23:00:00.0000000Z"); …
Giuseppe Romagnuolo
  • 3,362
  • 2
  • 30
  • 38
66
votes
6 answers

pytz - Converting UTC and timezone to local time

I have a datetime in utc time zone, for example: utc_time = datetime.datetime.utcnow() And a pytz timezone object: tz = timezone('America/St_Johns') What is the proper way to convert utc_time to the given timezone?
Tzach
  • 12,889
  • 11
  • 68
  • 115
65
votes
7 answers

How to set timestamps on GMT/UTC on Python logging?

Is it possible and how to set the logging timezone to GMT? (i.e. the %(asctime)s parameter in the format)
Jonathan Livni
  • 101,334
  • 104
  • 266
  • 359