To get week-number from a date
how I do it, get week-number from a date on micropython?
I'used utime but not found!
Somebody kindly can help me?
@Gijs Ask me again new year's day!
@kjm But will that always work though? I have a feeling this might break in some edge cases (week 53, new year week not starting on monday) or is that just in my head?
@StefanoF You could try time.localtime() which gives you day of the year then calculate week number from that? For example
should give weeks 0-51
rcolistete last edited by
@StefanoF Use frozen modules, building your firmware for LoPy v1.
Sorry, I did not notice that!
You could take a look at how they create the weeknumber and copy only that part.
Hi Giijs , Many thanks, I not can't writting on lopy 73kb it's very big...
This post is deleted!
It is indeed not built in by default.
I suggest you look at something like this? https://github.com/micropython/micropython-lib/blob/master/datetime/datetime.py. You can upload this in the lib folder and include it like
import datetime. This will be similar to the datetime Python library.