is there any API commands to get date and time and how ?
any module to be uploaded ?
I need the following values
Date
Year
month
day
hour
minute
sec
is there anything to get from OS the local Latitude and longitude may be ?
thanks
is there any API commands to get date and time and how ?
any module to be uploaded ?
I need the following values
Date
Year
month
day
hour
minute
sec
is there anything to get from OS the local Latitude and longitude may be ?
thanks
Have you checked out the standard ‘datetime’ Python module?
>> time.strftime("%A, %B %d %I:%M:%S %p")
‘Saturday, March 29 09:19:58 PM’
Coordinate from timezone is a bit vague, but maybe you can create an inverse from this algorithm:
thanks for example for this sun rise
I might use this one too later on
but I was thinking more for the Time zone from OS
to established in which time zone the PC is located
so dont’ need to add a new properties in panel to get that info if possible
is the date time given with high precision or only rough approximation ?
as long as it Is inside a minute I guess it does not matter for me
but some peoples might ask to get max precision !
I mean the algo for GMST is suppose to be inside something like 1 second!
thanks
OS stores an offset to UTC time only, this can be set by the user, just like the clock in UTC.
For precise current time, query an NTP server for atomic time and account for network latency.
is_dst = time.daylight and time.localtime().tm_isdst > 0
utc_offset = - (time.altzone if is_dst else time.timezone)
I thought PC Microsoft was already sync to some site with Atomic clock!
never had to reset clock on PC yet and it is always about right !
so this would get this UTC offset ?
and would give the timezone!
seems that we don’t realty have access yet to the local time
utc_offset = time.localtime().tm_gmtoff
this works only in 3.3
how do you convert the offset or what is it I get like -14000
so is this seconds to be converted to hours time?
there is also this local to UTC
tlolc=time.altzone
print (’ tlolc=’, tlolc )
I get like -10000
not certain if it is valid for daylight local time !
thanks
how do you split the values for time ?
I can see the different print format for data/time
but does not show how to split it !
also can see that you can print timezone name!
thanks
Windows should sync clock to atomic time via microsoft time server, but the timezone (=offset) is still a user setting.
This works unless utc_offset is > 1 day:
is_dst = time.daylight and time.localtime().tm_isdst > 0
utc_offset = - (time.altzone if is_dst else time.timezone)
time.strftime("%H:%M:%S", time.gmtime(utc_offset))
well I think I have a problem on my OS
have to find why UTC is not working !
but don’t really need to calculate it from long !
hope this can work on any OS too!
thanks