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

Last change on this file since 175 was 157, checked in by navarro, 18 years ago

header improvements + xxx doc

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