Home | History | Annotate | Download | only in scripts
      1 #!/usr/bin/env python
      2 import datetime
      3 import sys
      4 
      5 
      6 def build_to_date(build):
      7     letter = build[2]
      8     day = int(build[3:5])
      9 
     10     month = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.index(letter) * 3
     11     year = 2009 + (month / 12)
     12     month %= 12
     13 
     14     return datetime.date(year, month + 1, 1) + datetime.timedelta(days=day - 1)
     15 
     16 
     17 if __name__ == '__main__':
     18     if len(sys.argv) != 2:
     19         sys.exit('usage: aday BUILD_NUMBER')
     20 
     21     print build_to_date(sys.argv[1])
     22