www.digitalmars.com Home | Search | D | Comments
Last update Mon Aug 22 2005
D
Language
Phobos
Comparisons


object

std
 std.base64
 std.boxer
 std.compiler
 std.conv
 std.ctype
 std.date
 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.windows

std.linux

std.c
 std.c.stdio

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.

typedef 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.

An invalid value for d_time is represented by d_time.init.

int TicksPerSecond
A constant giving the number of Ticks per second for this implementation. It will be at least 1000.

char[] toString(d_time t)
Converts t 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 t is invalid, "Invalid date" is returned.

char[] toUTCString(d_time 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(d_time t)
Converts the date portion of t into a text string of the form: "Www Mmm dd yyyy", for example, "Tue Apr 02 1996". If t is invalid, "Invalid date" is returned.

char[] toTimeString(d_time t)
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.

d_time 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.init is returned.

void toISO8601YearWeek(d_time 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.

d_time getUTCtime()
Get current UTC time.

d_time UTCtoLocalTime(d_time t)
Convert from UTC time to local time.

d_time LocalTimetoUTC(d_time t)
Convert from local time to UTC time.

typedef DosFileTime
Type representing the DOS file date/time format.

d_time toDtime(DosFileTime time)
Convert from DOS file date/time to d_time.

DosFileTime toDosFileTime(d_time t)
Convert from d_time to DOS file date/time.

Feedback and Comments

Add feedback and comments regarding this page.
Copyright © 1999-2005 by Digital Mars, All Rights Reserved