Re: Epoch time - Date Time in DDMMYYHHMISS ( From-To conversion ) using standard utility
- From: Stephane Chazelas <stephane_chazelas@xxxxxxxx>
- Date: 11 Apr 2006 16:12:07 GMT
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
.
- References:
- Prev by Date: zsh scripting: reading from stdin if no args?
- Next by Date: Re: zsh scripting: reading from stdin if no args?
- Previous by thread: Re: Epoch time - Date Time in DDMMYYHHMISS ( From-To conversion ) using standard utility
- Next by thread: zsh scripting: reading from stdin if no args?
- Index(es):
Relevant Pages
|