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

Last change on this file since 133 was 126, checked in by pinsard, 18 years ago

improvements of Calendar/*.pro header

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