Questions tagged [gmt]

Greenwich Mean Time (GMT) is a term originally referring to mean solar time at the Royal Observatory in Greenwich, London.

Greenwich Mean Time (GMT) originally referred to mean solar time at the Royal Observatory in Greenwich, London, which later became adopted as a global time standard. It is arguably the same as Coordinated Universal Time (UTC).

Related tag:

Useful Links:

UK: GMT

USA: GMT-5 --- GMT -10

448 questions
576
votes
34 answers

How can I get the current date and time in UTC or GMT in Java?

When I create a new Date object, it is initialized to the current time but in the local timezone. How can I get the current date and time in GMT?
Behrang
  • 9,789
  • 6
  • 24
  • 19
187
votes
5 answers

What is the difference between UTC and GMT?

I have a few queries regarding the Time zones: Can the time be captured in UTC alone? Is UTC -6 and GMT -6 the same, and does that mean it is US local time? Say, I have UTC time as "02-01-2018 00:03" does that mean my US local time is "01-01-2018…
Anagha
  • 3,073
  • 8
  • 25
  • 43
117
votes
13 answers

Force Java timezone as GMT/UTC

I need to force any time related operations to GMT/UTC, regardless the timezone set on the machine. Any convenient way to so in code? To clarify, I'm using the DB server time for all operations, but it comes out formatted according to local…
SyBer
  • 5,407
  • 13
  • 55
  • 64
85
votes
3 answers

How to subtract hours from a datetime in MySQL?

I get a datetime field, that's currently in the query as: SELECT DATE_FORMAT(x.date_entered, '%Y-%m-%d') AS date FROM x ORDER BY date ASC What I want to do is to subtract 3 hours from that date (GMT issues), but I can't do it in PHP as PHP only…
Lucas Famelli
  • 1,565
  • 2
  • 15
  • 23
62
votes
3 answers

SimpleDateFormat parse loses timezone

Code: SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); System.out.println(new Date()); try { String d = sdf.format(new Date()); System.out.println(d); …
Achow
  • 8,600
  • 6
  • 39
  • 49
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
6 answers

NSDate - Convert Date to GMT

I need the ability to convert an NSDate value to a GMT Date. How can I go about converting an NSDate value to a GMT formatted NSDate value, independent of whatever date locale settings the iPhone device is using?
Mick
  • 521
  • 1
  • 5
  • 3
47
votes
5 answers

UNIX timestamp always in GMT?

UNIX timestamp always in GMT? I tried to run php function time() and when I tried to convert the unix timestamp from the time() function, the output is not similar to the computer time. Thank You
bbnn
  • 3,505
  • 10
  • 50
  • 68
40
votes
4 answers

GMT vs UTC dates

I have a calendar built in JavaScript that compares dates with PHP. The JavaScript date object is set using PHP, but, when I compare future dates, they appear to be out of sync. PHP is set to GMT and JavaScript is set to UTC; how do these standards…
Tom
  • 1,651
  • 3
  • 19
  • 19
38
votes
12 answers

Get GMT Time in Java

In Java, I want to get the current time in GMT. I tried various options like this: Date date = new Date(); Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); date1 = calendar.getTime(); But the date is always is interpreted in…
narayanan
  • 515
  • 2
  • 10
  • 19
38
votes
3 answers

NSTimeZone: Any difference between "UTC" and "GMT"?

Are these five statements interchangeable, or is anyone aware of cases where their use would yield different results? From what I gather they are equivalent but I haven't found anything conclusive, and potential differences between the GMT and the…
Clafou
  • 15,250
  • 7
  • 58
  • 89
35
votes
11 answers

Converting date between timezones swift

I have a date stored on my online server database which is in GMT. I load the date and convert it to the user's timezone using the following code : if let messagedate = oneitem["timestamp"] as? String { let dateFormatter = NSDateFormatter() …
Alk
  • 5,215
  • 8
  • 47
  • 116
33
votes
4 answers

PHP daylight saving time detection

I need to send an email to users based wherever in the world at 9:00 am local time. The server is in the UK. What I can do is set up a time difference between each user and the server's time, which would then perfectly work if DST didn't…
Nicolas
  • 2,754
  • 6
  • 26
  • 41
32
votes
9 answers

MySQL query for current GMT time

This sounds simple enough but I haven't been able to figure out how to use a simple SELECT statement to return the current time in GMT. I have been trying to use CONVERT_TZ() to convert NOW() to GMT based on the server time zone and the GMT time…
Russell C.
  • 1,649
  • 6
  • 33
  • 55
31
votes
6 answers

How to get GMT date in yyyy-mm-dd hh:mm:ss in PHP

I want to get the current date in yyyy-mm-dd hh:mm:ss format. I have tried: gmdate('yyyy-mm-dd hh:mm:ss \G\M\T', time()); Its returning a wierd date: 13131313-1111-2323 0707:1111:3131
clu3Less
  • 1,812
  • 3
  • 17
  • 20
1
2 3
29 30