summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-01-06 16:11:06 -0800
committerDan Albert <danalbert@google.com>2015-01-06 16:11:06 -0800
commit6313a60dc5a371e4f310e7e2b57b56aa65bd975c (patch)
tree94e4b9cfb43c1898e11b7e372397a0c5e8f00ba1 /scripts
parent817e1ef4876a237d71c40dddf0ad75b73ab72b31 (diff)
downloadandroid_development-6313a60dc5a371e4f310e7e2b57b56aa65bd975c.tar.gz
android_development-6313a60dc5a371e4f310e7e2b57b56aa65bd975c.tar.bz2
android_development-6313a60dc5a371e4f310e7e2b57b56aa65bd975c.zip
Add aday, which converts build numbers to dates.
Change-Id: I8d4219f961951ef1d84d3027d361378005764ee6
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/aday21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/aday b/scripts/aday
new file mode 100755
index 000000000..3d9780996
--- /dev/null
+++ b/scripts/aday
@@ -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])