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

Last change on this file since 318 was 318, checked in by smasson, 17 years ago

header cleaning

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.0 KB
Line 
1;+
2;
3; @file_comments
4; create a nice and readable format to print a date
5;
6; @categories
7; Calendar, String
8;
9; @param yyyymmdd {in}{required} {type=scalor or array}
10; the date in the format yyyymmdd.
11;
12; @keyword _EXTRA
13; Used to pass keywords to <proidl>string</proidl> function
14;
15; @returns
16; a string containing the date in a easy readable format with the
17; same number of elements than yyyymmdd.
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
27; Sebastien Masson (smasson\@lodyc.jussieu.fr)
28; Creation ???
29; update/review June 2005 Sebastien Masson.
30;
31; @version
32; $Id$
33;
34;-
35;
36FUNCTION date2string, yyyymmdd, _EXTRA = ex
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.