Although Cartographica isn't awash in great date functionality, mostly owing the the lack of solid date, time, and timezone support in many geospatial data formats, it Column Formulas do have access to the date functionality of Python, which means there are some sophisticated date capabilities available.
Most of the date and time functions work on datetime objects,
which are not usable by Cartographica directly.
However, they can be further operated on to retrieve the data stored within them by using
day
, month
, year
(and hour
, minute
, second
) accessors.
For example datetime.today().day
will provide the integer day of the month.
Dates can also be converted into strings by using the strftime()
method on a datetime
object.
For example, datetime.today().strftime("%Y-%m-%d")
will provide the current date in
"YYYY-MM-DD
" form, or 2020-01-23
if it were the date this page was being written.
datetime datetime.today( | ) ; |
Today's date as a datetime object.
datetime datetime.utcnow( | ) ; |
Today's date and time in UTC as a datetime object.
str .strftime( | format) ; |
str format
;String representation of the requested date using the specified format
.
int .weekday( | ) ; |
Return the day of the week as an integer (0=Sunday, 1=Monday, etc.).
str .ctime( | ) ; |
Return the date and time as a string in human-readable format.
datetime datetime.strptime( | date_string, | |
format) ; |
str date_string
;str format
;Create a new datetime object from the date_string using the requested format.