I want to find the last mid-night time stamp (only input is current timestamp). What is the best way?
I am writing python script for a global mobile application. The user request with the current timestamp, and in server side I want to find the last mid-night timestamp of the user with out affect time zone parameters.
I searched for it, I got a solution
import time
etime = int(time.time())
midnight = (etime - (etime % 86400)) + time.altzon
Its worked for me. But I am confused with time.altzon function, Is it create any problem for the users in different timezones.
To get the midnight timestamp of the client(mobile) you need to know the client’s timezone.
Output
Note: on my machine @phihag’s answer produces
1344470400.0that is different from the above (my machine is not in New York).