Ignore:
Timestamp:
04/26/06 16:29:38 (18 years ago)
Author:
pinsard
Message:

upgrade of CALENDRIER/Calendar according to cerbere.lodyc.jussieu.fr:/usr/home/smasson/SAXO_RD/ : files

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Calendar/date2string.pro

    r7 r9  
    33;------------------------------------------------------------ 
    44;+ 
    5 ; NAME: 
     5; NAME: date2string 
    66; 
    7 ; PURPOSE: 
     7; PURPOSE: create a nice and readable format to print a date 
    88; 
    9 ; CATEGORY: 
     9; CATEGORY: calendar/string 
    1010; 
    11 ; CALLING SEQUENCE: 
     11; CALLING SEQUENCE: nice_date = date2string(yyyymmdd) 
    1212;  
    13 ; INPUTS: 
     13; INPUTS: yyyymmdd the date in the format  
     14;         yearyearyearyearmonthmonthdayday 
    1415; 
    15 ; KEYWORD PARAMETERS: 
     16; KEYWORD PARAMETERS:those of string fonction to specify the 
     17;                    format of the month (the C format) 
    1618; 
    17 ; OUTPUTS: 
     19; OUTPUTS: a string containing the date in a easy readable format 
    1820; 
    19 ; COMMON BLOCKS: 
     21; COMMON BLOCKS:none 
    2022; 
    21 ; SIDE EFFECTS: 
     23; SIDE EFFECTS:? 
    2224; 
    23 ; RESTRICTIONS: 
     25; RESTRICTIONS:? 
    2426; 
    2527; EXAMPLE: 
    2628; 
     29;    IDL> print, date2string(19900123) 
     30;    Jan 23, 1990 
     31;    IDL> print, date2string(19900123, format = '(C(CMOA))') 
     32;    JAN 23, 1990 
     33; 
    2734; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) 
    28 ; 
     35; Creation ??? 
     36; update/review June 2005 Sebastien Masson. 
    2937;- 
    3038;------------------------------------------------------------ 
    3139;------------------------------------------------------------ 
    3240;------------------------------------------------------------ 
    33 FUNCTION date2string, date 
     41FUNCTION date2string, yyyymmdd, _EXTRA = ex 
    3442; 
    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 
     43   sday = strtrim(long(yyyymmdd) MOD 100, 1) 
     44   smonth = strtrim((long(yyyymmdd)/100) MOD 100, 2) 
     45   syear = strtrim(long(yyyymmdd)/10000, 2) 
     46   res = string(format = '(C(CMoa))', 31*(fix(smonth)-1), _EXTRA = ex) $ 
     47         + ' ' + sday + ', ' + syear 
    5848   return, res 
    5949end 
Note: See TracChangeset for help on using the changeset viewer.