Skip to content

Instantly share code, notes, and snippets.

@b0n
Created December 30, 2016 02:56
Show Gist options
  • Save b0n/533e406bbb9f6630a731b326d9ad75a1 to your computer and use it in GitHub Desktop.
Save b0n/533e406bbb9f6630a731b326d9ad75a1 to your computer and use it in GitHub Desktop.
30分間は同じ値です。
# -*- coding: utf-8 -*-
import datetime
import time
fmt = '%Y-%m-%d %H:%M'
add = datetime.timedelta(minutes=1)
start = datetime.datetime(2016, 12, 30, 17, 0, 0)
while(1) :
a = start.strftime(fmt)
#print start.strftime('%s')
#print (int)(start.strftime('%s'))
b = (int)(start.strftime('%s')) // ( 60 * 30 )
print a, ' ', b
start = start + add
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment