source: trunk/CALENDRIER/date2string.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: 1.4 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME:
6;
7; PURPOSE:
8;
9; CATEGORY:
10;
11; CALLING SEQUENCE:
12;
13; INPUTS:
14;
15; KEYWORD PARAMETERS:
16;
17; OUTPUTS:
18;
19; COMMON BLOCKS:
20;
21; SIDE EFFECTS:
22;
23; RESTRICTIONS:
24;
25; EXAMPLE:
26;
27; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
28;
29;-
30;------------------------------------------------------------
31;------------------------------------------------------------
32;------------------------------------------------------------
33FUNCTION date2string, date
34;
35@common
36;
37   s_date = strtrim(date, 2)
38   length = strlen(s_date)
39   sday = strtrim(fix(strmid(s_date,length-2)), 1)
40   smonth = strmid(s_date,length-4, 2)
41   syear = strmid(s_date, 0 ,length-4)
42;   res = syear+' '+string(format='(C(CMoA0))',31*(fix(smonth)-1))+'
43;   '+sday
44   if n_elements(langage) EQ 0 then langage = 'gb'
45   case langage of
46      'gb':BEGIN
47         truc = long(sday)
48         truc = truc-truc/10*10
49         case truc of
50            2:truc = 'nd'
51            3:truc = 'rd'
52            ELSE:truc = 'th'
53         endcase
54         res = string(format='(C(CMoA0))',31*(fix(smonth)-1))+' the '+sday+truc+' '+syear
55      END
56      ELSE:res = sday+' '+string(format='(C(CMoA0))',31*(fix(smonth)-1))+' '+syear
57   endcase
58   return, res
59end
Note: See TracBrowser for help on using the repository browser.