Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # clonen, patchen, uploaden
- git clone https://github.com/lorcap/upy-micropython-lib.git -b datetime
- cd upy-micropython-lib/python-stdlib/datetime/
- patch -p1 < localtz.patch
- rshell cp datetime.py /pyboard/lib/
- # remote repl
- rshell repl
- >>> from datetime import datetime, date, timezone, timedelta, time
- >>> datetime.now()
- datetime.datetime(2022, 3, 14, 13, 16, 58, 0, None, fold=0)
- >>> datetime.now() + timedelta(hours=1, minutes=1)
- datetime.datetime(2022, 3, 14, 14, 18, 31, 0, None, fold=0)
- >>> berlin = timezone(timedelta(hours=1), "Europe/Berlin")
- >>> datetime.now(berlin)
- datetime.datetime(2022, 3, 14, 14, 19, 34, 0, datetime.timezone(datetime.timedelta(microseconds=3600000000), 'Europe/Berlin'), fold=0)
- >>> datetime(2022, 1, 1) + timedelta(days=10)
- datetime.datetime(2022, 1, 11, 0, 0, 0, 0, None, fold=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement