DT_TM_TOJS Name
DT_TM_TOJS Purpose
Convert a date/time string to "Julian Seconds".
Category
Calling Sequence
js = dt_tm_tojs( dt) Inputs
dt = date/time string (may be array). in
(see date2ymd for format)
Keyword Parameters
Keywords
/YMD Date is all numeric: Year, Month, Day
/YDM Date is all numeric: Year, Day, Year
/DMY Date is all numeric: Day, Month, Year
/MDY Date is all numeric: Month, Day, Year
FORMAT=fmt Specify format of input.
Use the letters y,n,d in the same positions as year,
month, and day in the input string, and the pairs hh, mm,
and ss for hour, minute, second. Any other characters may
be used as place holders. Case is ignored. For example:
for txt='gs_06oct09_0208_multi.png' use
fmt='xx_yynnndd_hhmm_xxxxx.xxx'
If s and/or m are not used they default to 0.
Trailing placeholders are not really needed.
>>>===> Make sure to use n for month (m is for minute).
May also use with the all numeric keywords if needed.
All input strings must have the same format to use this.
Times given with no colons must use a format.
BASE=base Use to convert 2-digit years to 4-digit years.
If 2-digit year is not close to the current year then
give in base a year close to the years to convert.
ERROR=err Error flag: 0=ok, else error.
/QUIET means inhibit error message.
Outputs
js = "Julian Seconds". out
Common Blocks
Notes
Notes: Julian seconds (not an official unit) serve the
same purpose as Julian Days, interval computations.
The zero point is 0:00 1 Jan 2000, so js < 0 before then.
Julian Seconds are double precision and have a precision
better than 1 millisecond over a span of +/- 1000 years.
2 digit years (like 17 or 92) are changed to the closest
corresponding 4 digit year.
See also dt_tm_fromjs, ymds2js, js2ymds, jscheck.
Modification History
R. Sterner, 23 Jul, 1992
R. Sterner, 1994 Mar 29 --- Modified to handle arrays.
R. Sterner, 1999 aug 04 --- Improved 2 digit year case.
R. Sterner, 2000 aug 17 --- Added /QUIET
R. Sterner, 2005 Jan 02 --- Allowed numeric dates.
R. Sterner, 2006 Nov 09 --- Added FORMAT=fmt.
R. Sterner, 2008 Aug 06 --- Passed QUIET in to yy2yyyy.
R. Sterner, 2009 May 14 --- Handled time correctly if given a format.
R. Sterner, 2009 May 14 --- Added keyword BASE=base.
R. Sterner, 2010 Apr 29 --- Converted arrays from () to [].
R. Sterner, 2010 Jun 17 --- Now can handle day of year.
R. Sterner, 2010 Sep 17 --- Now gets any fractional part of seconds.
Copyright (C) 1992, Johns Hopkins University/Applied Physics Laboratory
This software may be used, copied, or redistributed as long as it is not
sold and this copyright notice is reproduced on each copy made. This
routine is provided as is without any express or implied warranties
whatsoever. Other limitations apply as described in the file disclaimer.txt.