am ec63f63c: Merge "Add aday, which converts build numbers to dates."

* commit 'ec63f63c9ac9aa77e35eb375ce5307b534e21d82':
  Add aday, which converts build numbers to dates.
This commit is contained in:
Dan Albert
2015-01-07 00:34:37 +00:00
committed by Android Git Automerger

21
scripts/aday Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env python
import datetime
import sys
def build_to_date(build):
letter = build[2]
day = int(build[3:5])
month = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.index(letter) * 3
year = 2009 + (month / 12)
month %= 12
return datetime.date(year, month + 1, 1) + datetime.timedelta(days=day - 1)
if __name__ == '__main__':
if len(sys.argv) != 2:
sys.exit('usage: aday BUILD_NUMBER')
print build_to_date(sys.argv[1])