-2

Can you please tell me how can I convert this date string to total seconds in python?

This string format is 'years-months-days hours:mins:secs'

'2013-01-01 01:01:01'

user806696
  • 19
  • 2

1 Answers1

0

Use

import time
answer = time.mktime(time.strptime(string, '%Y-%m-%d %H:%M:%S'))
randomusername
  • 7,927
  • 23
  • 50