ページの改善
いますぐフォークしてオンライン編集し、このページのプルリクエストを送信します。
Github へのログインが必要です。 これは小さな変更に適しています。
大きな変更を加えたい場合は、通常の cloneの使用をお勧めします。
日本語版について
個人的な学習のために、dlang.orgを翻訳したサイトです。
翻訳に際して、様々なサイトを参考にしています。
std.datetime
Phobos provides the following functionality for time:
This functionality is separated into the following modules
Functionality | Symbols |
---|---|
Points in Time | Date TimeOfDay DateTime SysTime |
Timezones | TimeZone UTC LocalTime PosixTimeZone WindowsTimeZone SimpleTimeZone |
Intervals and Ranges of Time | Interval PosInfInterval NegInfInterval |
Durations of Time | Duration weeks days hours minutes seconds msecs usecs hnsecs nsecs |
Time Measurement and Benchmarking | MonoTime StopWatch benchmark |
- std.datetime.date for points in time without timezones.
- std.datetime.timezone for classes which represent timezones.
- std.datetime.systime for a point in time with a timezone.
- std.datetime.interval for types which represent series of points in time.
- std.datetime.stopwatch for measuring time.
License:
Authors:
Jonathan M Davis and Kato Shoichi
Source std/datetime/package.d
Examples:
Get the current time from the system clock
import std.datetime.systime : SysTime, Clock; SysTime currentTime = Clock.currTime();
Examples:
Construct a specific point in time without timezone information
and get its ISO string.
import std.datetime.date : DateTime; auto dt = DateTime(2018, 1, 1, 12, 30, 10); writeln(dt.toISOString()); // "20180101T123010" writeln(dt.toISOExtString()); // "2018-01-01T12:30:10"
Examples:
Construct a specific point in time in the UTC timezone and
add two days.
import std.datetime.systime : SysTime; import std.datetime.timezone : UTC; import core.time : days; auto st = SysTime(DateTime(2018, 1, 1, 12, 30, 10), UTC()); writeln(st.toISOExtString()); // "2018-01-01T12:30:10Z" st += 2.days; writeln(st.toISOExtString()); // "2018-01-03T12:30:10Z"
Copyright © 1999-2022 by the D Language Foundation | Page generated by
Ddoc on Wed Nov 23 08:33:40 2022