Forum Discussion
catsrock1023
Jun 01, 2021Copper Contributor
Return current date for year
I need some help building a formula. I need to return the current year of a date in a cell in the YYYY-MM-DD format. For example, in one cell I have 1997-11-10 and I need it to return 2021-11-10 in a...
HansVogelaar
Jun 01, 2021MVP
Let's say the date 1997-11-10 is in cell B2.
The formula you want is
=DATE(YEAR(TODAY()),MONTH(B2),DAY(B2))
catsrock1023
Jun 01, 2021Copper Contributor
what if it's a string of text? i'm using this formula in a different program that supports the use of excel formulas. it uses the ISO 8601 date but projects it as "Nov 11, 1997"
I tried the above formula with no success, I think something similar to this:
CONCATENATE(YEAR(TODAY()), "-", TEXT(DATEVALUE(B2), "YYYY-MM-DD")
should work but is not working lol. any suggestions based on this info?
I tried the above formula with no success, I think something similar to this:
CONCATENATE(YEAR(TODAY()), "-", TEXT(DATEVALUE(B2), "YYYY-MM-DD")
should work but is not working lol. any suggestions based on this info?
- HansVogelaarJun 01, 2021MVP
Do you mean that the cell (B2 in this example) contains a text value? What do you see in the formula bar when you select that cell?
- catsrock1023Jun 01, 2021Copper Contributorit's difficult to explain, but i'm not using excel for this, just need an excel formula (https://generalcaster.app/website/documentation/formula/ is the app i am using)
that doesn't really answer your question, i'm sorry!- SergeiBaklanJun 01, 2021Diamond Contributor
Perhaps in formula which HansVogelaar suggested you shall use DATEVALUE(B2) instead of B2
=DATE(YEAR(TODAY()),MONTH(DATEVALUE(B2)),DAY(DATEVALUE(B2)))