Formats a date string. Args: date: input date string Returns: formatted date
(date)
| 165 | |
| 166 | @staticmethod |
| 167 | def date(date): |
| 168 | """ |
| 169 | Formats a date string. |
| 170 | |
| 171 | Args: |
| 172 | date: input date string |
| 173 | |
| 174 | Returns: |
| 175 | formatted date |
| 176 | """ |
| 177 | |
| 178 | if date: |
| 179 | date = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S") |
| 180 | |
| 181 | # 1/1 dates had no month/day specified, use only year |
| 182 | if date.month == 1 and date.day == 1: |
| 183 | return date.strftime("%Y") |
| 184 | |
| 185 | return date.strftime("%Y-%m-%d") |
| 186 | |
| 187 | return None |
| 188 | |
| 189 | @staticmethod |
| 190 | def text(text): |