dateparser
dateparser copied to clipboard
QUESTION: parameter or method to print the code format of the date
Is there a parameter or method to print the code format string that matches the parsed date? For example, in the following code:
from datetime import datetime
now = datetime.now()
date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
print("date and time:",date_time)
You will get:
date and time: 12/21/2021, 22:08:06
So with this code:
dateparser.parse(date_time)
You will get:
datetime.datetime(2021, 12, 21, 22, 08, 06)
Is there a way to run something like this?:
dateparser.get_date_pattern(date_time)
And as a result:
"%m/%d/%Y, %H:%M:%S"
I saw a similar question in Stack Overflow: https://stackoverflow.com/q/33986096/6315428
The purpose? Generate synthetic data for privacy protection, looking to express dates in the same original format, replacing the value with a different one.