Can date format current time for GMT timezone?

You can use date -u (universal time) which is equivalent to GMT.

Quoting date manual:

‘-u’ ‘--utc’ ‘--universal’

Use Universal Time by operating as if the ‘TZ’ environment variable were set to the string ‘UTC0’. UTC stands for Coordinated Universal Time, established in 1960. Universal Time is often called “Greenwich Mean Time” (GMT) for historical reasons. Typically, systems ignore leap seconds and thus implement an approximation to UTC rather than true UTC.


Use the following command:

TZ=GMT date

The same format:

TZ=GMT date +"%Y%m%d%H%M%S"
20171225194014

Tags:

Timezone

Date