Answer the question
In order to leave comments, you need to log in
How to convert datetime to past?
The question is funny, but still,
the date arrives to me as a string 1/15/29, I need to get 1929, but I get 2029...
Answer the question
In order to leave comments, you need to log in
Let's start with the fact that it's impossible.
Guilt on those who send a year without a century.
Kick them and correct the situation on the back.
It's not a front issue.
If there are no options to fix the back, then abandon this crooked API.
PS And if you arrive "1/1/21" or "11/11/20"?.
What year will this be? 1921 or 2021, 1920 or 2020?
How will your code work in three months? And after 9 years? And after 70?
And how are you going to distinguish the 20th century from the 21st with this format?
And how do you know that it is 1929, and not, for example, 1029?
If, of course, all dates are within the 20th century, then you can forcibly split and add 19 before the year.
But in general, this is a question for the one who gives the data in this form.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question