Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Library Reference

version 2.112.0

overview

Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinga local clone.

std.datetime

Phobos provides the following functionality for time:
FunctionalitySymbols
Points in TimeClock Date TimeOfDay DateTime SysTime 
TimezonesTimeZone UTC LocalTime PosixTimeZone WindowsTimeZone SimpleTimeZone 
Intervals and Ranges of TimeInterval PosInfInterval NegInfInterval 
Durations of TimeDuration weeks days hours minutes seconds msecs usecs hnsecs nsecs 
Time Measurement and BenchmarkingMonoTime StopWatch benchmark 
This functionality is separated into the following modules:
See Also:
core.time
Introduction to std.datetime
ISO 8601
Wikipedia entry on TZ Database
List of Time Zones
License:
Boost License 1.0.
Authors:
Jonathan M Davis and Kato Shoichi

Sourcestd/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 informationand 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 andadd 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-2026 by theD Language Foundation | Page generated byDdoc on Sat Feb 21 04:08:18 2026

[8]ページ先頭

©2009-2026 Movatter.jp