Day of week from date
aberba
karabutaworld at gmail.com
Fri Sep 29 14:34:04 UTC 2017
On Friday, 29 September 2017 at 03:42:18 UTC, Jonathan M Davis
wrote:
> On Friday, September 29, 2017 04:32:44 rikki cattermole via
> Digitalmars-d- learn wrote:
>> On 29/09/2017 4:25 AM, Joel wrote:
>> > With a given date, I want to know what day it is (like
>> > Sunday, Monday,
>> > etc).
>> >
>> > I had a look up on std.datetime, and core.time, but they
>> > don't seem to have a function for it.
>>
>> https://dlang.org/phobos/std_datetime_date.html#.DateTime.dayOfWeek
>
> Date and SysTime also have that function. So, whether you're
> creating one of those types manually - e.g. Date(2012, 7, 19) -
> or getting it from the system clock - e.g. Clock.currTime() -
> dayOfWeek will give you the day of the week for that particular
> object. TimeOfDay is the only time point type in std.datetime
> that does not have dayOfWeek, but that's because it makes no
> sense given that it simply represents a time of day.
>
> - Jonathan M Davis
The documentation of std.datetime is very confusing at first.
Monotime, Clock, DateTime, SysTime (deprecated?) ... can confuse
you even though their names seems obvious when you're used to....
And then there's secs, mins, etc and those undocumented ones.
More information about the Digitalmars-d-learn
mailing list