datetime_str

PlasmaCalcs.tools.history.datetime_str(datetime_=None, *, sep='_', tz='local', timespec='seconds')

datetime as string, including timezone.

Uses “isoformat”, with “_” separator: YYYY-MM-DD_HH:MM:SS+HH:MM
Datetime (timezone-aware) can be recovered via datetime.datetime.fromisoformat(str)
datetime_: None or datetime.datetime object
datetime to convert to string. If None, use datetime.datetime.now().
sep: string
separator between date and time. ‘_’ nice when spaces not desireable (e.g. file names).
‘T’ is nice for more universal recognizability; ‘ ‘ too but slightly less universal.
tz: None, ‘local’, ‘utc’, or datetime.tzinfo object
timezone to convert result to.
None –> do not convert.
‘local’ –> machine’s local timezone.
‘utc’ –> standard/universal time (UTC) (i.e. result will end in +00:00)
timespec: str, probably ‘seconds’ or ‘microseconds’
passed to datetime.isoformat(). ‘microseconds’ –> YYYY-MM-DD_HH:MM:SS.ssssss+HH:MM