0

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

  • How about using `perl`? – Armali Jun 01 '23 at 09:40
  • 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. – Udit Maheshwari Jun 02 '23 at 17:10

1 Answers1

0

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'
    
Armali
  • 18,255
  • 14
  • 57
  • 171