Get date at compile time

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 1 08:00:29 PDT 2016


On Saturday, 1 October 2016 at 14:43:31 UTC, Adam D. Ruppe wrote:
> On Saturday, 1 October 2016 at 14:41:22 UTC, Andrew wrote:
>> Is there any way to get the system date at compile time.
>
> Not exactly, but the special symbol __TIMESTAMP__ gets a string 
> out of the compiler at build time.
>
> http://dlang.org/spec/lex.html#specialtokens

Has there been consideration for adding separate integral tokens 
for day, month, year, etc?

The documentation there doesn't seem to specify but I assume 
currently the timestamps are for local time? Though I don't 
currently have any need for this feature I'd imagine that if I 
did I'd want the time in UTC, not locally, or if it was local 
that I'd at least want to be able to similarly retrieve the 
timezone info.



More information about the Digitalmars-d-learn mailing list