source: trunk/CALENDRIER/juldate.pro @ 2

Last change on this file since 2 was 2, checked in by opalod, 22 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME: juldate
6;
7; PURPOSE:  gives julian date equivalent of a date in vairmer
8;           ( yymmdd or yyyymmdd ) format
9;           sets month, day and year to the corresp values
10;
11; CATEGORY: bidouilles dates
12;
13; CALLING SEQUENCE:  date = juldate(930124)
14;
15; INPUTS:date de la forme yymmdd ou yyyymmdd
16;
17; KEYWORD PARAMETERS:
18;
19;       VRAIDATE: pour ne pasa transformer l''annnee 01 en 1901
20;
21; OUTPUTS:date en jour julien
22;
23; COMONTHON BLOCKS:
24;       common.pro      vraidate
25;
26; SIDE EFFECTS:
27;   l'annee 0 n'existant pas, qd year est nulle on calcule le
28;     jour julien de l'annee -1.
29;   COMPATIBLE AVEC L'AN 2000 !!!: une date de la forme yymmdd est
30;    donvertit sous la forme yyyymmdd a l''aide de vraidate.
31;   Attention, les variables globales year, month day sont attribuees
32;
33; MODIFICATION HISTORY: Jerome Vialard  (jv@lodyc.jussieu.fr)
34;                       2/7/98
35;-
36;------------------------------------------------------------
37;------------------------------------------------------------
38;------------------------------------------------------------
39function juldate, vvdate, _EXTRA = ex
40vdate = vvdate
41vdate = vraidate(vdate, _EXTRA = ex)
42@common
43;------------------------------------------------------------
44   year=vdate/10000
45   month=vdate/100 - year*100
46   day=abs(vdate - year*10000 - month*100)
47   month = abs(month)
48;
49   mm = month & dd = day & yy = year
50;------------------------------------------------------------
51   ndate = n_elements(vdate)
52   if total(mm EQ 0) EQ ndate then mm[*] = 6
53   if total(dd EQ 0) EQ ndate then dd[*] = 15
54   if total(yy EQ 0) EQ ndate THEN yy[*] = -1
55;------------------------------------------------------------
56   return, julday(mm,dd,yy, _EXTRA = ex)
57;------------------------------------------------------------
58   return, -1
59end
60;------------------------------------------------------------
61
Note: See TracBrowser for help on using the repository browser.