Quantcast
Channel: Convert Unix timestamp to a date string - Stack Overflow
Browsing all 13 articles
Browse latest View live

Answer by F. Hauri - Give Up GitHub for Convert Unix timestamp to a date string

3 remarks:.1 about bashAs this question is tagged bash and no answer here address printfbashism:Syntax: printf '%(fmt)T' $UNIXEPOCHUnder bash, from V4.2, (Feb 2011), The printf builtin has a %(fmt)T...

View Article



Answer by Itachi for Convert Unix timestamp to a date string

Python:python -c "from datetime import datetime; print(datetime.fromtimestamp($TIMESTAMP))"

View Article

Answer by Dangelov for Convert Unix timestamp to a date string

Put the following in your ~/.bashrc :function unixts() { date -d "@$1"; }Example usage:$ unixts 1551276383Wed Feb 27 14:06:23 GMT 2019

View Article

Answer by denmojo for Convert Unix timestamp to a date string

Other examples here are difficult to remember. At its simplest:date -r 1305712800

View Article

Answer by Tony Mountifield for Convert Unix timestamp to a date string

Slight correction to dabest1's answer above. Specify the timezone as UTC, not GMT:$ date -d '1970-01-01 1416275583 sec GMT'Tue Nov 18 00:53:03 GMT 2014$ date -d '1970-01-01 1416275583 sec UTC'Tue Nov...

View Article


Answer by Greg A. Woods for Convert Unix timestamp to a date string

As @TomMcKenzie says in a comment to another answer, date -r 123456789 is arguably a more common (i.e. more widely implemented) simple solution for times given as seconds since the Unix Epoch, but...

View Article

Answer by dabest1 for Convert Unix timestamp to a date string

This solution works with versions of date which do not support date -d @. It does not require AWK or other commands. A Unix timestamp is the number of seconds since Jan 1, 1970, UTC so it is important...

View Article

Answer by William Pursell for Convert Unix timestamp to a date string

The standard Perl solution is:echo $TIMESTAMP | perl -nE 'say scalar gmtime $_'(or localtime, if preferred)

View Article


Answer by qbi for Convert Unix timestamp to a date string

If you find the notation awkward, maybe the -R-option does help. It outpouts the date in RFC 2822 format. So you won't need all those identifiers: date -d @1278999698 -R. Another possibility is to...

View Article


Answer by qbi for Convert Unix timestamp to a date string

date -d @1278999698 +'%Y-%m-%d %H:%M:%S'Where the number behind @ is the number in seconds

View Article

Answer by John Kugelman for Convert Unix timestamp to a date string

With date from GNU coreutils you can do:date -d "@$TIMESTAMP"# date -d @0Wed Dec 31 19:00:00 EST 1969(From: BASH: Convert Unix Timestamp to a Date)On OS X, use date -r.date -r...

View Article

Answer by Sjoerd for Convert Unix timestamp to a date string

awk 'BEGIN { print strftime("%c", 1271603087); }'

View Article

Convert Unix timestamp to a date string

Is there a quick, one-liner way to convert a Unix timestamp to a date from the Unix command line?date might work, except it's rather awkward to specify each element (month, day, year, hour, etc.), and...

View Article

Browsing all 13 articles
Browse latest View live




Latest Images