## 12.7. The mx.DateTime Module
## 12.7.1. Date and Time TypesPackage Date and time types supply customized string conversion, invoked via the built-in YYYY-MM-DD HH:MM:SS.ss For finer-grained control of string formatting, use method ## 12.7.2. The DateTime TypeModule ## 12.7.2.1. Factory functions for DateTimeModule
## 12.7.2.2. Methods of DateTime instancesThe most commonly used methods of a
## 12.7.2.3. Attributes of DateTime instancesThe most commonly used attributes of a absdate 's absolute date; like*d**d*`.absvalues( )[0]`absdays A floating-point number representing days (and fraction of a day) since the epoch abstime 's absolute time; like*d**d*`.absvalues( )[1]`date A string in format `'YYYY-MM-DD'`; the standard ISO format for the date of*d*day An integer between `1`and`31`; the day of the month of*d*day_of_week An integer between `0`and`6`; the day of the week of(Monday is*d*`0`)day_of_year An integer between `1`and`366`; the day of the year of(January 1 is*d*`1`)dst An integer between `-1`and`1`, indicating whether DST is in effect on date, assuming*d*is represented in local time (*d*`-1`is unknown,`0`is no, and`1`is yes)hour An integer between `0`and`23`; the hour of the day of*d*iso_week A three-item tuple `(`*year*`,`*week*`,`*day*`)`with the ISO week notation for(*d*is week-of-year;*week*is between*day*`1`, Monday, and`7`, Sunday)minute An integer between `0`and`59`; the minute of the hour of*d*month An integer between `1`and`12`; the month of the year of*d*second A floating-point number between `0.0`and`60.0`; the seconds-within-minute of(*d*`DateTime`instances do not support leap seconds)year An integer; the year of (*d*`1`is 1 CE and`0`is 1 BCE)
## 12.7.2.4. Arithmetic on DateTime instancesYou can use binary operator . In this case, d2d1- is a d2DateTimeDelta instance representing the elapsed time between and d1, which is greater than d20 if is later than d1. You can use binary operators d2+ and - between a DateTime instance and a number dn. d+n, d-, and nn+ are all dDateTime instances that differ from by d (or n-) days (and fraction of a day if n is a floating-point number), and nn- is arbitrarily defined to be equal to dd-.n## 12.7.3. The DateTimeDelta TypeInstances of type ## 12.7.3.1. Factory functions for DateTimeDeltaModule
## 12.7.3.2. Methods of DateTimeDelta instancesThe most commonly used methods of a
## 12.7.3.3. Attributes of DateTimeDelta instancesA day hour minute second Like the four items of the tuple returned by *d*`.tuple( )`days hours minutes seconds Each a floating-point value giving 's value in the given unit of measure so that:*d*
## 12.7.3.4. Arithmetic on DateTimeDelta instancesYou can add or subtract two to add or subtract the signed time intervals they represent. You can use binary operators d2+ and - between a DateTimeDelta instance and a number d; n is taken as a number of seconds (and fraction of a second if n is a floating-point value). You can multiply or divide n by d to scale the time interval n represents. Each operation returns a dDateTimeDelta instance. You can also add or subtract a DateTimeDelta instance to or from a ddDateTime instance to get another dDateTime instance that differs from d1 by the signed time interval indicated by d.dd## 12.7.4. Other AttributesModule oneWeek oneDay oneHour oneMinute oneSecond Instances of `DateTimeDelta`that represent the indicated durationsMonday Tuesday Wednesday Thursday Friday Saturday Sunday Integers that represent the weekdays: Monday is `0`, Tuesday is`1`, and so on
Weekday A dictionary that maps integer weekday numbers to their string names and vice versa: `0`maps to`'Monday', 'Monday'`maps to`0`, and so onJanuary February March April May June July August September October November December Integers that represent the months: January is `1`, February is`2`, and so onMonth A dictionary that maps integer month numbers to their string names and vice versa: `1`maps to`'January', 'January'`maps to`1`, and so on
Module
## 12.7.5. SubmodulesPackage [ Module |