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
65
votes
6 answers

UTC Date/Time String to Timezone

How do I convert a date/time string (e.g. 2011-01-01 15:00:00) that is UTC to any given timezone php supports, such as America/New_York, or Europe/San_Marino.
amax
  • 653
  • 1
  • 5
  • 4
63
votes
3 answers

How to Convert UTC Date To Local time Zone in MySql Select Query

I am using this Where Condition in One Of my query with MySql Database.My Problem is that i have one displaytime column in my table but that table column shows the data in UTC Time.and i want to convert that displaytime column in the Local Time…
BhavikKama
  • 8,566
  • 12
  • 94
  • 164
60
votes
7 answers

How do I make MySQL's NOW() and CURDATE() functions use UTC?

I want to make it so calls to NOW() and CURDATE() in MySQL queries return the date in UTC. How do I make this happen without going through and changing all queries that use these functions?
Chad Johnson
  • 21,215
  • 34
  • 109
  • 207
60
votes
6 answers

Setting timezone to UTC (0) in PHP

Why does this work? date_default_timezone_set('Australia/Currie'); But this doesn't seem to take any effect at all? date_default_timezone_set('UTC'); This value doesn't change when setting the timezone to UTC: echo date('Y-m-d H:i:s',…
Andres SK
  • 10,779
  • 25
  • 90
  • 152
60
votes
4 answers

How to parse date/time from string?

Input: strings with date and optional time. Different representations would be nice but necessary. The strings are user-supplied and can be malformed. Examples: "2004-03-21 12:45:33" (I consider this the default layout) "2004/03/21 12:45:33"…
Gabriel Schreiber
  • 2,166
  • 1
  • 20
  • 33
60
votes
3 answers

Java 8 Convert given time and time zone to UTC time

I have a time with string type like: "2015-01-05 17:00" and ZoneId is "Australia/Sydney". How can I convert this time information to the corresponding to UTC time using Java 8 datetime API? Also need to considering DST stuff.
ttt
  • 3,934
  • 8
  • 46
  • 85
59
votes
9 answers

How can I get the current time (now) in UTC?

I have a python datetime object (representing five minutes from now) which I would like to convert to UTC. I am planning to output it in RFC 2822 format to put in an HTTP header, but I am not sure if that matters for this question. I found some…
Elias Zamaria
  • 96,623
  • 33
  • 114
  • 148
59
votes
2 answers

Scala UTC timestamp in seconds since January 1st, 1970

How do I get the Scala UTC timestamp in seconds since January 1st, 1970?
user1491739
  • 1,017
  • 2
  • 11
  • 16
55
votes
5 answers

How to get UTC value for SYSDATE on Oracle

Probably a classic... Would you know a easy trick to retrieve an UTC value of SYSDATE on Oracle (best would be getting something working on the 8th version as well). For now I've custom function :( Cheers, Stefan
stic
  • 1,008
  • 3
  • 10
  • 23
54
votes
2 answers

UTC vs ISO format for time

I'm trying to understand the difference between UTC and ISO formats and when to use what when transferring messages between servers. So When I try the following this is what I get new Date().toISOString() "2019-11-14T00:55:31.820Z" new…
tmp dev
  • 8,043
  • 16
  • 53
  • 108
53
votes
7 answers

Difference between UTC and GMT Standard Time in .NET

In .NET, the following statements return different values: Response.Write( TimeZoneInfo.ConvertTime( DateTime.Parse("2010-07-01 5:30:00.000"), TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"), …
frankadelic
  • 20,543
  • 37
  • 111
  • 164
52
votes
3 answers

What's the difference between datetime in ISO 8601 and UTC formats in javascript?

I pick some date and time in javascript and then want to store it on server (.NET). Dates are supposed to be in future from the current moment (so they won't be before 1970). Having read topics here on SO I learnt it's better to store date as a…
myroman
  • 561
  • 1
  • 5
  • 11
52
votes
8 answers

UTC Offset in PHP

What's the easiest way to get the UTC offset in PHP, relative to the current (system) timezone?
Adam Ernst
  • 52,440
  • 18
  • 59
  • 71
52
votes
10 answers

How to convert UTC timestamp to device local time in android

I need to convert the UTC time stamp that I get from the server to local device time. Currently, I get 5 hrs difference in my time. For example, when I post to the server, the post time says 5 hours ago instead of a second ago. How could I fix this…
cavallo
  • 4,414
  • 9
  • 39
  • 61
52
votes
7 answers

Convert Java Date to UTC String

The java.util.Date toString() method displays the date in the local time zone. There are several common scenarios where we want the data to be printed in UTC, including logs, data export and communication with external programs. What's the best way…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562