0

How to convert string param to date var in Hewlett-Packard UNIX (HP-UX)?

date -d
date: illegal option -- d

Can not use -d

I need the following:

the_date=`date`
date_in_seconds=$($the_date+"%s") 

Any insight?

javaPlease42
  • 4,699
  • 7
  • 36
  • 65
yuris
  • 1,109
  • 4
  • 19
  • 33
  • Can you clarify for me - are you looking for a way to get the date in seconds since epoch on HP-UX or something else entirely? (I answered the former below). – verdammelt Jan 17 '14 at 04:34

1 Answers1

0

After a bit of googling I see that it is a relatively common question that has a two main answers:

  1. Install GNU date
  2. perl -e 'print time(), "\n"' (several references amongst others)

EDIT: although I worry I've misunderstood your question...

verdammelt
  • 922
  • 10
  • 22