Kinda...you can change the year to 1970 if you want, this also converts
to minutes, not seconds. It is a really ugly function but it seems to
work. You could always use perl.
function f_minutes {
# Funky function I use to calculate the number of minutes since 2000
MIN_YEAR=$( date +"%Y" )
MIN_YEAR=$( expr ${MIN_YEAR} - 2000 )
MIN_YEAR=$( expr ${MIN_YEAR} \* 525600 )
MIN_DAYS=$( date +"%j" )
MIN_DAYS=$( expr "${MIN_DAYS}" - 1 )
MIN_DAYS=$( expr "${MIN_DAYS}" \* 1440 )
MIN_HOURS=$( date +"%H" )
MIN_HOURS=$( expr "${MIN_HOURS}" \* 60 )
MIN_MINS=$( date +"%M" )
MIN_TOTAL=$(( ${MIN_YEAR} + ${MIN_DAYS} + ${MIN_HOURS} + ${MIN_MINS} ))
print ${MIN_TOTAL}
}
# Funky function I use to calculate the number of minutes since 2000
MIN_YEAR=$( date +"%Y" )
MIN_YEAR=$( expr ${MIN_YEAR} - 2000 )
MIN_YEAR=$( expr ${MIN_YEAR} \* 525600 )
MIN_DAYS=$( date +"%j" )
MIN_DAYS=$( expr "${MIN_DAYS}" - 1 )
MIN_DAYS=$( expr "${MIN_DAYS}" \* 1440 )
MIN_HOURS=$( date +"%H" )
MIN_HOURS=$( expr "${MIN_HOURS}" \* 60 )
MIN_MINS=$( date +"%M" )
MIN_TOTAL=$(( ${MIN_YEAR} + ${MIN_DAYS} + ${MIN_HOURS} + ${MIN_MINS} ))
print ${MIN_TOTAL}
}
-----Original Message-----
From: Adams, Matthew (GECP, MABG, 088130) [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 24, 2003 1:14 PM
To: Multiple recipients of list ORACLE-L
Subject: unix time conversion functionAnybody got a handy little function to
convert a standard unix seconds-since-Jan-1970 epoch
time (stored as a number) to a readable date?It would save me a lot of time not having to re-invent the
wheel.Matt
----
Matt Adams - GE Appliances - [EMAIL PROTECTED]
My computer beat me at chess, but I won
when it came to kick boxing.