Method Calendar.YMD.YMD()->datetime()


Method datetime

mapping datetime()

Description

This gives back a mapping with the relevant time information (representing the start of the period);

 ([ "year":     int        // year number (2000 AD=2000, 1 BC==0)
    "month":    int(1..)   // month of year
    "day":      int(1..)   // day of month
    "yearday":  int(0..)   // day of year
    "week":     int(1..)   // week of year
    "week_day": int(0..)   // day of week
    "timezone": int        // offset to utc, including dst
 
    "unix":     int        // unix time
    "julian":   int        // julian day
 // for compatibility:
    "hour":     0          // hour of day, including dst
    "minute":   0          // minute of hour
    "second":   0          // second of minute
    "fraction": 0.0        // fraction of second
 ]);

Note

Day of week is compatible with old versions, ie, 0 is sunday, 6 is saturday, so it shouldn't be used to calculate the day of the week with the given week number. Year day is also backwards compatible, ie, one (1) less then from the year_day() function.

If this function is called in a Week object that begins with the first week of a year, it returns the previous year if that is where the week starts. To keep the representation unambiguous, the returned week number is then one more than the number of weeks in that year.

E.g. Week(2008,1)->datetime() will return year 2007 and week 53 since the first week of 2008 starts in 2007.