source: trunk/SRC/Calendar/date2string.pro @ 114

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

new compilation options (compile_opt idl2, strictarrsubs) in each routine

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments create a nice and readable format to print a date
7;
8; @categories calendar, string
9;
10; @param yyyymmdd {in}{required} the date in the format yyyymmdd
11;
12; @file_comments keyword parameters of string function to specify the format of the month (the C format) can be used
13;
14; @returns a string containing the date in a easy readable format
15;
16; @examples
17;
18;    IDL> print, date2string(19900123)
19;    Jan 23, 1990
20;    IDL> print, date2string(19900123, format = '(C(CMOA))')
21;    JAN 23, 1990
22;
23; @history Sebastien Masson (smasson\@lodyc.jussieu.fr)
24; Creation ???
25; update/review June 2005 Sebastien Masson.
26;-
27;------------------------------------------------------------
28;------------------------------------------------------------
29;------------------------------------------------------------
30FUNCTION date2string, yyyymmdd, _EXTRA = ex
31;
32;
33  compile_opt idl2, strictarrsubs
34;
35   sday = strtrim(long(yyyymmdd) MOD 100, 1)
36   smonth = strtrim((long(yyyymmdd)/100) MOD 100, 2)
37   syear = strtrim(long(yyyymmdd)/10000, 2)
38   res = string(format = '(C(CMoa))', 31*(fix(smonth)-1), _EXTRA = ex) $
39         + ' ' + sday + ', ' + syear
40   return, res
41end
Note: See TracBrowser for help on using the repository browser.