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

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

review of Colors and Calendar routines

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