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
RevLine 
[9]1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
[97]6; @file_comments gives julian day equivalent of a date in yyyymmdd format
[9]7;
[93]8; @categories calendar
[9]9;
[93]10; @param date {in}{required} date in yyyymmdd format
[9]11;
[93]12; @keyword /GRADS {in}{optional}
13;               if  1 <= year <= 49 --> year = 2000 + year
[9]14;               if 50 <= year <= 99 --> year = 1900 + year
15;
[93]16; @returns date in julian day
[9]17;
[93]18; @examples
[9]19;
[93]20;    IDL> jday = juldate(19930124)
[9]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;
[93]26; @history Sebastien Masson (smasson@lodyc.jussieu.fr)
[9]27;                       June 2005
28;-
29;------------------------------------------------------------
30;------------------------------------------------------------
31;------------------------------------------------------------
32function date2jul, date, GRADS = grads
33;------------------------------------------------------------
[114]34;
35  compile_opt idl2, strictarrsubs
36;
[9]37   year = long(date) / 10000
[69]38   month = long(abs(date)/100) MOD 100
39   day = long(abs(date)) MOD 100
[9]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.