Re: Date format

From: McHugh, Jerome (jmchugh@TOWERRECORDS.COM)
Date: Mon Jan 13 2003 - 19:59:12 EST


Klugy but it works - month expressed as numeric value with leading space for single digit months.
 
#!/bin/ksh
typeset -i Date # set the variable type to integer - This strips off the leading zero
typeset -R2 PadDate # Set the variable PadDate to field width of two - pads single values with space
Date=$(date '+%m') # Get the current month in two digits with leading zeros and store that value as an integer
PadDate=${Date} # Set PadDate value to Date value expressed as Right justified with a field width of 2
print "${PadDate}" # display the result
 
 
Jerome McHugh
Senior Systems Administrator, Lead

        -----Original Message-----
        From: abdelkarim.daddi-hammou@VMD.DESJARDINS.COM [mailto:abdelkarim.daddi-hammou@VMD.DESJARDINS.COM]
        Sent: Monday, January 13, 2003 10:41 AM
        To: aix-l@Princeton.EDU
        Subject: Re: Date format
        
        

        Yes,
        
        I know that, but without the leading zero, I want a blank in the place of zero as with %e for the day which is different from %d.
        
        
        
        
        Abdelkarim Daddi-Hammou
        Administrateur de systèmes UNIX /WebSphere -
        UNIX /WebSphere Systems Administrator
        Valeurs Mobilières Desjardins - Desjardins Securities
        tél. (514) 281-2244 x 7604
        adh@vmd.desjardins.com
        
        
        
        
        "Sheets, Jerald" <JSHeets@OLOLRMC.COM>
Sent by: IBM AIX Discussion List <aix-l@Princeton.EDU>

13/01/2003 13:30
Please respond to IBM AIX Discussion List

        
        To: aix-l@Princeton.EDU
        cc:
        Subject: Re: Date format

        %m Displays the month of year as a decimal number (01-12).
          
        
        Jerald M. Sheets
        Sr. UNIX Systems Administrator
        Our Lady of the Lake Regional Medical Center
        225-765-8734
          
          
          
          
          
          
         -----Original Message-----
        From: abdelkarim.daddi-hammou@VMD.DESJARDINS.COM [mailto:abdelkarim.daddi-hammou@VMD.DESJARDINS.COM]
        Sent: Monday, January 13, 2003 10:30 AM
        To: aix-l@Princeton.EDU
        Subject: Date format
        
        
        Hi,
        
        I am looking for a clue to display the month as a decimal number (1-12), in a two-digit field, with a blank space as leading space fill instead of zero.
        
        There is a similar option for the Day, but I didn't find it for month :
        
        
        %e Displays the day of the month as a decimal number (1-31). In a two-digit
        field, a blank space is used as leading space fill.
        
        
        Any idea ?
        
        TIA
        
        
        Abdelkarim Daddi-Hammou
        Administrateur de systèmes UNIX /WebSphere -
        UNIX /WebSphere Systems Administrator
        Valeurs Mobilières Desjardins - Desjardins Securities
        tél. (514) 281-2244 x 7604
        adh@vmd.desjardins.com
        
        
        



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:28 EDT