Skip to content

Instantly share code, notes, and snippets.

View gheja's full-sized avatar
🤘

Gabor Heja gheja

🤘
View GitHub Profile
@mrluanma
mrluanma / datetime2stamp.py
Created July 6, 2012 02:21
Convert datetime to Unix timestamp.
def datetime2stamp(year, month, day, hour, minute, second):
timestamp = 0
for y in range(year - 1, 1969, -1):
if is_leap_year(y):
day += 366
else:
day += 365
month_day = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]