Forum Discussion
indresh268
Dec 10, 2022Copper Contributor
Date format showing different after downloading
Dear Experts, from an application i am downloading the data dump, and from when filetring on the date column its showing as '01-Jan-29' as Jan-2029 and '01-Jan-30' and after as Jan 1930 and so on...
HansVogelaar
Dec 10, 2022MVP
Let's say your dates are in A2 and down.
In another cell in row 2, enter the formula
=EDATE(A2,1200*(YEAR(A2)<2000))
and fill down.
You can either use the new dates, or copy them, then paste them as Values over the original dates.
- indresh268Dec 10, 2022Copper ContributorThis logic is working fine when using in excel formatting. could you please explain the logic of the same so that i can use this in my code for download option.
Thank you.- HansVogelaarDec 10, 2022MVP
Apparently the download specifies the year using only 2 digits. Excel (or rather Windows) then has to decide whether 40 means 1940 or 2040. There is a cutoff for this in Regional Settings. On many systems, 30 is the cutoff: 00 to 29 are interpreted as 2000 to 2029, and 30 to 99 are interpreted as 1930 to 1999.
So Excel will convert 1-Jan-30 to 01/01/1930.
The formula that I posted checks whether the year of the converted date is before 2000, and if so, adds 100 years = 1200 months using the EDATE function.
In VBA, you could use DateAdd("yyyy", 100, SomeDate) to add 100 years.
- indresh268Dec 11, 2022Copper ContributorDear hans,
Thank you for the reply, tried this solution and its working for the date column.
but customer wanted the date as customized and our solution stores the same in text column.
but when I apply your suggestion over there, these columns are as text type instead of date.
Now I need to read and every columns as value and check for the format 'DD-MON-YY' and if values matches needs to convert that as date and apply.
will update you with the progress. meanwhile if you have any suggestion regarding this via javascript please let me know.
Thank you.
Regards,
Indra