Tiny utilities to work with the standard timeranges expected in FOT reports. These utilities change back and forth from string specifications (e.g. “2009-Q1” for the first quarter of 2009) and “timerange” dictionaries which are of the form
{ ‘type’ : ‘quarter’,‘start’: mx.DateTime of the start time,‘stop’ : mx.DateTime of the stop time,‘year’ : 2009‘subid’ : ‘Q1’}
Find the time range after the given one
Parameters: | range – timerange dictionary |
---|---|
Return type: | timerange dictionary |
Find the time range before the given one
Parameters: | range – timerange dictionary |
---|---|
Return type: | timerange dictionary |
Find all of the day ranges from now-N days to now.
Parameters: | days – N days back as starting point |
---|---|
Return type: | dict of labeled day ranges |
which month contains a reference date
Parameters: | ref_date – mx.DateTime reference date |
---|---|
Return type: | range_string e.g. 2007-M12 |
which FOT quarter contains a reference date
Parameters: | ref_date – reference date |
---|---|
Return type: | range_string e.g. 2009-Q1 |
which FOT half-year contains a reference date
Parameters: | ref_date – mx.DateTime reference date |
---|---|
Return type: | range_string e.g. 2009-S1 |
which year contains a reference date
Parameters: | ref_date – mx.DateTime reference date |
---|---|
Return type: | range_string e.g. ‘2010’ |
month range
Parameters: |
|
---|---|
Return type: | timerange dictionary |
range of a FOT quarter
Parameters: |
|
---|---|
Return type: | timerange dictionary |
range of a FOT half-year
Parameters: |
|
---|---|
Return type: | timerange dictionary |
range from string specifier
Parameters: | rstring – range string |
---|---|
Return type: | timerange dictionary |
find year start, stop
Parameters: | year – int year |
---|---|
Return type: | timerange dictionary |