0

We are interested in calculating a date using input fields that have month values and day values. For example the year_sent can be 2021, month_sent can be 0 and date_sent can be 31 for the date Jan 31st, 2021.

tz = pytz.timezone(obj_timezone)    
timestamp_current_tz_start_of_day   = datetime(year_sent, month_sent, date_sent, 0, 0, tzinfo=tz)

timestamp_current_start_of_day      = int((timestamp_current_tz_start_of_day - datetime(1970, 1, 1,0,0, tzinfo=pytz.utc)).total_seconds() * 1000)

We expect the timestamp_current_start_of_day to be Jan 31st, 2021 12:00am Timezone. But instead we get Jan 31st, 2021, 12:53am Timezone.

What are we doing wrong?

FObersteiner
  • 22,500
  • 8
  • 42
  • 72
Jack tileman
  • 813
  • 2
  • 11
  • 26

0 Answers0