Minor fixes in datetime

- You can directly parse time using strptime
- Going back 30 days will give wrong result if the current month is March. Since you just need the previous month, going back a single day is more than enough.