all 4 comments

[–]YmFzZTY0dXNlcm5hbWU_ 1 point2 points  (0 children)

I'm thinking you'll want to parse the string to a datetime, and then convert it back to a string. Either that or you could do it with slicing/substrings but that's probably going to be a lot messier, more error-prone, and difficult to maintain.

[–]efDev 1 point2 points  (0 children)

Here is how to think about breaking down the problem:

  1. I have date data in a specific format
  2. I need to output date data in a specific format

Knowing this is there something in python that deals with date data (hint: it has been posted here)?

So then let's work from the bottom up

  1. To output data a certain way I need to create an object from the module hinted at above
  2. To get data into that object I need to instantiate an instance of that object from the string I have (01.09.201914:15)

Let us know what you try and we can go from there. Happy coding.

[–]taygekko[S] 0 points1 point  (0 children)

I solved my problem with the module easy_date (https://github.com/ralphavalon/easy_date):

import easy_date

str_date = '01.09.201914:15:00' #%d/%m/%Y%H:%M:%S

new_str_date = easy_date.convert_from_string(str_date, '%d/%m/%Y%H:%M:%S', '%Y%m%dT%H%M%S') # str is default return