I want to create a UNIX timestamp for the date 2014-10-31 for every minute of the day. I have got a timestamp for the date but not for every minute -
import datetime
date = '2014-10-31'
t_stamp = int(time.mktime(datetime.datetime.strptime(date, "%Y-%m-%d").timetuple()))
print t_stamp
I want to save all these entries in a file which I need to access later to get specific entries only.
If I need to access one of the timestamp records using a date and specific time, how can it be done? For example, I need to find the entries for 2014-31-10 for the time between 20:00 and 20:05, how can it be done?
Any help would be appreciated!
Updated:
import datetime
import ipaddress
from random import randint
for x in ip_range.hosts():
for h in range(24): #24 hours
for i in range(60): # 60 minutes
f.write(str(t_stamp)+'\t'+str(x)+'\t0\t'+str(randint(0,100))+'%\n')
f.write(str(t_stamp)+'\t'+str(x)+'\t1\t'+str(randint(0,100))+'%\n')
t_stamp += 60 # one minute
Now I am looking to create a log file for every minute. How can that be done?
1440minutes in 24 hours, making all the timestamps should be pretty easy using that.