source: trunk/Calendar/date2jul.pro @ 69

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

debug + new xxx

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME: date2jul
6;
7; PURPOSE: gives julian day equivalent of a date in yyyymmdd format
8;
9; CATEGORY: calendar
10;
11; CALLING SEQUENCE: jday = juldate(19930124)
12;
13; INPUTS: date in yyyymmdd format
14;
15; KEYWORD PARAMETERS:
16;
17;       /GRADS: if  1 <= year <= 49 --> year = 2000 + year
18;               if 50 <= year <= 99 --> year = 1900 + year
19;
20; OUTPUTS:date en jour julien
21;
22; COMMON BLOCKS: none
23;
24; SIDE EFFECTS: ?
25;
26; RESTRICTIONS: ?
27;
28; EXAMPLE:
29;
30;    IDL> print, date2jul(19931205) EQ julday(12,5,1993)
31;       1
32;    IDL> print, date2jul(931205,/grads) EQ julday(12,5,1993)
33;       1
34;
35; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr)
36;                       June 2005
37;-
38;------------------------------------------------------------
39;------------------------------------------------------------
40;------------------------------------------------------------
41function date2jul, date, GRADS = grads
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.