Re: Epoch time - Date Time in DDMMYYHHMISS ( From-To conversion ) using standard utility



On 10 Apr 2006 23:44:09 -0700, sujit wrote:
Hi,

Is thr a way to get epoch time and convert it to DDMMYYHHMISS ( or any
standard date time format ) and again back conversion ( i.e. from
DDMMYYHHMISS to epoch time )
using STANDARD UNIX UTILITY Only ... We can always write a C Prog to Do
That and But I mean a STANDARD UTILITY which is likely to be available
in most ( if not all ) UNIX or on related flavors
[...]

See http://stchaz.free.fr/wide_strftime.sh

and:

awk 'BEGIN {srand(); print srand()}'

to get the current epoch time.

In a Unix or even POSIX conformant shell:

eval "$(wget -qO- http://stchaz.free.fr/wide_strftime.sh)"
now=$(awk 'BEGIN {srand(); print srand()}')
wide_strftime "5 minutes later: %T" "$(($now + 60 * 5))"
printf '%s\n' "$REPLY"

It only supports UTC dates.

--
Stephane
.



Relevant Pages