strptime
-
I believe this function is not available, what is the workaround?
ReportingTimeSTR = "2019-01-01 {}:{}:{}".format(ReportingTime[0:2], ReportingTime[2:4], ReportingTime[4:6])
RT = datetime.strptime(ReportingTimeSTR, '%Y-%m-%d %H:%M:%S')Thanks
-
@Phil Depending, what you are using it on and how you use the time information, would utime.localtime() give you the information you need? As a tuple it isn't hard to format the returned data into a string.
-
It hands back a proper Time Structure:
typedef struct _timeutils_struct_time_t {
uint16_t tm_year; // i.e. 2014
uint8_t tm_mon; // 1..12
uint8_t tm_mday; // 1..31
uint8_t tm_hour; // 0..23
uint8_t tm_min; // 0..59
uint8_t tm_sec; // 0..59
uint8_t tm_wday; // 0..6 0 = Monday
uint16_t tm_yday; // 1..366
} timeutils_struct_time_t;Then maybe..., Thanks
-
Actually I think I can do what I need by using mktime() :
t = (2009, 2, 17, 17, 3, 38, 1, 48, 0)
secs = time.mktime( t )
print("time.mktime(t) : %f" % secs)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login