0
  • I get the client timestamp as Wed, 20 Nov 2013 13:53:35 GMT
  • I want to convert this into a python utc timestamp so that I can subtract it and get remaining number of days in month
def get_days_left_in_month(from_date):
        # todo : how to validate if from_date is valid?
        start_day, end_day = Day.get_start_end_days_for_year_and_month(
            from_date.year, from_date.month
        )
        remaining_days = (end_day - from_date).days
        return remaining_days if remaining_days == 0 else remaining_days - 1

How can I do this using python?

daydreamer
  • 87,243
  • 191
  • 450
  • 722

1 Answers1

0

Try this

import time
a = "Wed, 20 Nov 2013 13:53:35 GMT"
time.strptime(a, "%a, %d %b %Y %H:%M:%S %Z")

And have a look here for available formats.