DateTime class weekday_js and weekday_py properties¶
This page explains the DateTime
class’s weekday_js
and weekday_py
properties interfaces.
What interface are these?¶
The weekday_js
property gets a JavaScript weekday value (Sunday is 0, and Saturday is 6).
Similarly, the weekday_py
property gets a Python weekday value (Monday is 0, and Sunday is 6).
These interfaces have only the getter interface (there is no setter interface).
Basic usage¶
A DateTime
instance has these properties interfaces.
These getter interfaces return a weekday’s Int
value.
import apysc as ap
ap.Stage()
# 2022-12-11 is Sunday.
datetime_: ap.DateTime = ap.DateTime(year=2022, month=12, day=11)
weekday_js: ap.Int = datetime_.weekday_js
assert weekday_js == 0
weekday_py: ap.Int = datetime_.weekday_py
assert weekday_py == 6
weekday_js property API¶
Note: the document build script generates and updates this API document section automatically. Maybe this section is duplicated compared with previous sections.
[Interface summary]
Get a current weekday value. This interface sets the weekday based on the JavaScript value as follows:
・0 -> Sunday
・1 -> Monday
・2 -> Tuesday
・3 -> Wednesday
・4 -> Thursday
・5 -> Friday
・6 -> Saturday
[Returns]
weekday
: IntA current weekday value.
[Examples]
>>> import apysc as ap
>>> _ = ap.Stage()
>>> datetime_: ap.DateTime = ap.DateTime(year=2022, month=12, day=4)
>>> datetime_.weekday_js # Sunday
Int(0)
>>> datetime_ = ap.DateTime(year=2022, month=12, day=10)
>>> datetime_.weekday_js # Saturday
Int(6)
weekday_py property API¶
Note: the document build script generates and updates this API document section automatically. Maybe this section is duplicated compared with previous sections.
[Interface summary]
Get a current weekday value. This interface sets the weekday based on the Python value as follows:
・0 -> Monday
・1 -> Thursday
・2 -> Wednesday
・3 -> Thursday
・4 -> Friday
・5 -> Saturday
・6 -> Sunday
[Returns]
weekday
: IntA current weekday value.
[Examples]
>>> import apysc as ap
>>> _ = ap.Stage()
>>> datetime_: ap.DateTime = ap.DateTime(year=2022, month=12, day=5)
>>> datetime_.weekday_py # Monday
Int(0)
>>> datetime_: ap.DateTime = ap.DateTime(year=2022, month=12, day=4)
>>> datetime_.weekday_py # Sunday
Int(6)