1#!/usr/bin/env python
2import datetime
3import sys
4
5
6def 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
17if __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