D
Language
Phobos
Comparisons
object
std
std.base64
std.boxer
std.compiler
std.conv
std.cover
std.ctype
std.date
std.demangle
std.file
std.format
std.gc
std.intrinsic
std.math
std.md5
std.mmfile
std.openrj
std.outbuffer
std.path
std.process
std.random
std.recls
std.regexp
std.socket
std.socketstream
std.stdint
std.stdio
std.cstream
std.stream
std.string
std.system
std.thread
std.uri
std.utf
std.zip
std.zlib
std.c.fenv
std.c.math
std.c.process
std.c.stdarg
std.c.stddef
std.c.stdio
std.c.stdlib
std.c.string
std.c.time
std.c.wcharh
std.windows.charset
std.windows
std.linux
std.c.windows
std.c.linux
|
std.date
Dates are represented in several formats. The date implementation revolves
around a central type, d_time, from which other formats are converted to and
from.
- alias d_time;
- d_time is a signed arithmetic type giving the time elapsed since January 1,
1970.
Negative values are for dates preceding 1970. The time unit used is Ticks.
Ticks are milliseconds or smaller intervals.
The usual arithmetic operations can be performed on d_time, such as adding,
subtracting, etc. Elapsed time in Ticks can be computed by subtracting a
starting d_time from an ending d_time.
- const long d_time_nan;
- A value for d_time that does not represent a valid time.
- TicksPerSecond
- Will be at least 1000
- void toISO8601YearWeek(long t, out int year, out int week);
- Compute year and week [1..53] from t. The ISO 8601 week 1 is the first week
of the year that includes January 4. Monday is the first day of the week.
- long UTCtoLocalTime(long t);
- Convert from UTC to local time.
- long LocalTimetoUTC(long t);
- Convert from local time to UTC.
- char[] toString(long time);
- Converts UTC time into a text string of the form:
"Www Mmm dd hh:mm:ss GMT+-TZ yyyy".
For example, "Tue Apr 02 02:04:57 GMT-0800 1996".
If time is invalid, i.e. is d_time_nan,
the string "Invalid date" is returned.
Example:
d_time lNow;
char[] lNowString;
// Grab the date and time relative to UTC
lNow = std.date.getUTCtime();
// Convert this into the local date and time for display.
lNowString = std.date.toString(lNow);
- char[] toUTCString(long t);
- Converts t into a text string of the form: "Www, dd Mmm yyyy hh:mm:ss UTC".
If t is invalid, "Invalid date" is returned.
- char[] toDateString(long time);
- Converts the date portion of time into a text string of the form: "Www Mmm dd
yyyy", for example, "Tue Apr 02 1996".
If time is invalid, "Invalid date" is returned.
- char[] toTimeString(long time);
- Converts the time portion of t into a text string of the form: "hh:mm:ss
GMT+-TZ", for example, "02:04:57 GMT-0800".
If t is invalid, "Invalid date" is returned.
- long parse(char[] s);
- Parses s as a textual date string, and returns it as a d_time.
If the string is not a valid date, d_time_nan is returned.
- long getUTCtime();
- Get current UTC time.
- typedef DosFileTime;
- Type representing the DOS file date/time format.
- long toDtime(DosFileTime time);
- Convert from DOS file date/time to d_time.
- DosFileTime toDosFileTime(long t);
- Convert from d_time to DOS file date/time.
|