Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3037

Show
Ignore:
Timestamp:
12/18/07 01:26:13 (1 year ago)
Author:
kris
Message:

asDay() and asMonth() were removed from Date, since they belong in a Locale instead

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/example/system/localtime.d

    r3033 r3037  
    1212 
    1313        Example code to format a local time in the following format: 
    14         "Wed Dec 31 16:00:00 GMT-0800 1969" 
     14        "Wed Dec 31 16:00:00 GMT-0800 1969". The day and month names 
     15        would typically be extracted from a locale instance, but we 
     16        convert them locally here for the sake of simplicity 
    1517 
    1618******************************************************************************/ 
     
    1820void main () 
    1921{ 
     22        /// list of day names 
     23        static char[][] days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; 
     24 
     25        /// list of month names 
     26        static char[][] months = 
     27        [ 
     28            "Jan", "Feb", "Mar", "Apr", "May", "Jun", 
     29            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", 
     30        ]; 
     31 
    2032        // retreive local time 
    2133        auto dt = WallClock.toDate; 
     
    2941        // format date 
    3042        Stdout.formatln ("{}, {} {:d2} {:d2}:{:d2}:{:d2} GMT{}{:d2}:{:d2} {}", 
    31                           dt.date.asDay
    32                           dt.date.asMonth
     43                          days[dt.date.dow]
     44                          months[dt.date.month-1]
    3345                          dt.date.day, 
    3446                          dt.time.hours,