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

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

review of Colors and Calendar routines

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