-1

Other questions are either about UTC timestamp or GMT formatted date.

Someone with hands-on knowledge of SimpleDateFormat, Date etc. could know this on top of his head, I hope.

Mladen Adamovic
  • 3,071
  • 2
  • 29
  • 44
  • I know nothing about Linux and what is special about the Linux GMT timestamp, but you could call the native method using reflection? If it is just differently formatted, you can reformat the current (Java) timestamp using a format string. – Neijwiert Mar 02 '16 at 11:16
  • the server uses different timezone i.e. CEST or EST and java app on it is supposed to get GMT timestamp to send to a certain API, so your idea seems not as a solution to me, thanks for trying :-) – Mladen Adamovic Mar 02 '16 at 11:18
  • try `JODATIME` Jars.. this jars may help you out. :) – Vikrant Kashyap Mar 02 '16 at 11:20
  • @VikrantKashyap I know it is possible with Joda, if someone do not post the answer – Mladen Adamovic Mar 02 '16 at 11:24
  • Unix (not Linux) timestamps don't vary by time zone - wherever you are, the current timestamp is the number of seconds/milliseconds since midnight GMT on 1 January 1970. – Ben Mar 02 '16 at 11:49

1 Answers1

0

Hm, according to http://www.timeanddate.com/time/gmt-utc-time.html UTC and GMT there is no difference caused by daylight saving or whatsoever.

Therefore, correct answer seems to be

System.currentTimeMillis()

(returns timestamp in UTC, which seems to be the same as timestamp in GMT)

The confusion was caused by a certain API doc which specifically asked for timestamp in GMT timezone.

Mladen Adamovic
  • 3,071
  • 2
  • 29
  • 44