What’s the standard way to obtain the date
or datetime
from the local machine using pure Mojo? I don’t see it from a quick search of the online docs, nor could kapa.ai provide a code example. Thanks!
Hi, turns out the date command is POSIX,
so here is an quick way to get it:
from subprocess import run
def main():
var current = run(“date”)
print(current)
The is also external_call
to do it with an libc,
but i’m not familiar with theses structs, so there was my workaround
Excellent…that method works for me too! Thanks!!
`from subprocess import run
dt_iso_8601 = run("date --iso-8601")`
1 Like
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.