Local Vs GMT date and times
Posted: Wed Feb 26, 2003 6:06 pm
currentily:
(now) => (2003 2 26 21 49 19 875000 57 4) in GMT!
and
(date (apply date-value (now))) =>
"Wed Feb 26 19:12:04 2003" corrected to Local Time
Goal goal was/is to generate a log file name XX20030326.log
that changes to XX20030327.log midnight local time.
(define make-log-file-name ( log-path , month day datestamp)
(setq rightnow (now)
datestamp (parse (date (apply date-value IT:rightnow)))
month (find (nth 1 datestamp)
'("" "bob" "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul"
"Aug" "Sep" "Oct" "Nov" "Dec"))
month (if (< month 10) (append "0" (string month)) (string month))
day (nth 2 datestamp)
day (if (< (length day) 2) (append "0" day) day))
(append log-path "XX" (string (nth 6 datestamp)) month day ".log"))
Returns <log-path>XXyyyymmdd.log
Wish List item:
(now) with an offest or time-zone or a local-flag,
That returned (2003 2 26 21 49 19 875000 57 4)
(now local-flag) format corrected for local time or any
specified timezone would be great!
Here is a snipit that will return the current local time in HH:MM:SS format:
(setq datestamp (parse (date (apply date-value (now))))
timestamp (append (string (nth 3 datestamp))
(string (nth 4 datestamp)) ":"
(string (nth 5 datestamp)))
(now) => (2003 2 26 21 49 19 875000 57 4) in GMT!
and
(date (apply date-value (now))) =>
"Wed Feb 26 19:12:04 2003" corrected to Local Time
Goal goal was/is to generate a log file name XX20030326.log
that changes to XX20030327.log midnight local time.
(define make-log-file-name ( log-path , month day datestamp)
(setq rightnow (now)
datestamp (parse (date (apply date-value IT:rightnow)))
month (find (nth 1 datestamp)
'("" "bob" "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul"
"Aug" "Sep" "Oct" "Nov" "Dec"))
month (if (< month 10) (append "0" (string month)) (string month))
day (nth 2 datestamp)
day (if (< (length day) 2) (append "0" day) day))
(append log-path "XX" (string (nth 6 datestamp)) month day ".log"))
Returns <log-path>XXyyyymmdd.log
Wish List item:
(now) with an offest or time-zone or a local-flag,
That returned (2003 2 26 21 49 19 875000 57 4)
(now local-flag) format corrected for local time or any
specified timezone would be great!
Here is a snipit that will return the current local time in HH:MM:SS format:
(setq datestamp (parse (date (apply date-value (now))))
timestamp (append (string (nth 3 datestamp))
(string (nth 4 datestamp)) ":"
(string (nth 5 datestamp)))