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

Last change on this file since 133 was 126, checked in by pinsard, 18 years ago

improvements of Calendar/*.pro header

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