Monday 15 March 2010

datetime - Unix -- Time zone issue -



datetime - Unix -- Time zone issue -

i need predict next run of daily job. example, if job runs everyday @ 1:00:00 am, , sysdate nov 7 11:20:00 am, next run @ nov 8 1:00:00 am

the below logic helps me accomplish desired results. however, when convert date after adding no. days start date, unix considers daylight saving , converts pdt timezone pst timezone , gives me time lag of 1 hour. instead of getting nov 8 1:00:00 am, getting nov 8 00:00:00 output.

i want derive date without day lite savings. can help me accomplish logic in unix?

curr_date=`date "+%s"` start_date=`date -d "19oct2014 01:00:00" "+%s"` #start date when job run first diff_quo=$(((($curr_date - $start_date) / (86400)))) diff_quo=$(($diff_quo * 86400)) new_datetime=$(($start_date + $diff_quo + 86400 )) derived_date=`date -d"@$new_datetime" "+%b %d %h:%m:%s"`

thanks, ekata

unix datetime timezoneoffset

No comments:

Post a Comment