To Work on few shell scripts and I need to get the time in terms of epoch in hp-ux

I tried using

date +%s

but i got bad format character - s error i am allowed to use -u and -a options with date command in the environemnt

1

There are 1 best solutions below

0
Armali On

i tried perl but i dont have DateFormat library and TimePiece library is not installed. and i dont know how to deal with the epoch conversion from GMT to EST-10EDT timezone while factoring in the daylight saving in the EST-10EDT timezone.

  • for GMT you can simply use

    perl -e 'print time'
    
  • for local time you can use

    perl -e 'use POSIX qw(mktime); print mktime localtime'