date.tcl defines the two formatting procedures
format_jdn
and
format_mjd,
as well as these functions.
These two formatting procedures use the standard Tcl
clock
command.
The range of dates which
clock
can handle depends on the platform.
The current (8.4.7) Windows version uses a 32-bit signed integer offset (seconds) from
1970-01-01, allowing dates from 1901-12-13 to 2038-01-19.
format_jdn jdn [format]
jdn can be any NAP expression.
format is that required for the
clock
command.
The default format is
"%Y-%m-%d",
which produces a standard ISO 8601 date in the form "yyyy-mm-dd".
% format_jdn 2453305
2004-10-26
% format_jdn 2453305 "%A %B %d, %Y"
Tuesday October 26, 2004
% format_jdn "{0 7} + date2jdn{2004 10 22}"
2004-10-22
2004-10-29
% format_jdn "{0 7} + date2jdn{2004 10 22}" "%y %m %d"
04 10 22
04 10 29
format_mjd mjd [format]
mjd can be any NAP expression. This is rounded to the nearest second.
format is that required for the
clock
command.
The default format is
"%Y-%m-%dT%H:%M:%S",
which produces a standard ISO 8601 date/time in the form "yyyy-mm-ddTHH:MM:SS".
% format_mjd 49797.75
1995-03-21T18:00:00
% format_mjd 49797.75 "%I %p on %A %d %B, %Y."
06 PM on Tuesday 21 March, 1995.
% format_mjd "{0 0.5} + dateTime2mjd{2004 10 22 16 30 59}"
2004-10-22T16:30:59
2004-10-23T04:30:59
% format_mjd "{0 0.5} + dateTime2mjd{2004 10 22 16 30 59}" "%y%m%d %H%M"
041022 1630
041023 0430