source: trunk/SRC/Calendar/date2jul.pro @ 114

Last change on this file since 114 was 114, checked in by smasson, 18 years ago

new compilation options (compile_opt idl2, strictarrsubs) in each routine

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments gives julian day equivalent of a date in yyyymmdd format
7;
8; @categories calendar
9;
10; @param date {in}{required} date in yyyymmdd format
11;
12; @keyword /GRADS {in}{optional}
13;               if  1 <= year <= 49 --> year = 2000 + year
14;               if 50 <= year <= 99 --> year = 1900 + year
15;
16; @returns date in julian day
17;
18; @examples
19;
20;    IDL> jday = juldate(19930124)
21;    IDL> print, date2jul(19931205) EQ julday(12,5,1993)
22;       1
23;    IDL> print, date2jul(931205,/grads) EQ julday(12,5,1993)
24;       1
25;
26; @history Sebastien Masson (smasson@lodyc.jussieu.fr)
27;                       June 2005
28;-
29;------------------------------------------------------------
30;------------------------------------------------------------
31;------------------------------------------------------------
32function date2jul, date, GRADS = grads
33;------------------------------------------------------------
34;
35  compile_opt idl2, strictarrsubs
36;
37   year = long(date) / 10000
38   month = long(abs(date)/100) MOD 100
39   day = long(abs(date)) MOD 100
40;------------------------------------------------------------
41   if keyword_set(grads) then year = year $
42     + 1900 * (year GE 50 AND year LE 99) $
43     + 2000 * (year GE  1 AND year LE 49)
44;------------------------------------------------------------
45   return, julday(month, day, year)
46end
47
Note: See TracBrowser for help on using the repository browser.