pycom-documentation icon indicating copy to clipboard operation
pycom-documentation copied to clipboard

Add example to print datetime.now as string

Open robmarkcole opened this issue 7 years ago • 0 comments

Feature Request 🚀

Currently https://docs.pycom.io/firmwareapi/pycom/machine/rtc does not show a nice example of formatting the datetime as a string. This would be useful as the standard python approach doesn't appear to work - rtc.now() returns a tuple and strftime is not anywhere in the pycom library from what I can see.

>>> rtc.now()
(2018, 11, 9, 5, 18, 18, 201719, None)
>>> rtc.now().strftime("%m%d%H%M%S")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'tuple' object has no attribute 'strftime'

robmarkcole avatar Nov 09 '18 05:11 robmarkcole