Converting a date in a text type to Date type
Hi, I have a column as text/number type with date value such as '2023-06-27 09:02:53' and I want to have another column and convert it to DATE column type.
e.g "Date as Text Type" column is a text/number field. I want to convert this to DATE and put in the "Date as DateType" column.
is there a way to do it?
Best Answer
-
Carson Penticuff ✭✭✭✭✭
You will need to make sure your [Date as DateType] column is formatted as Date. This also assumes your [Date as Text Type] column is always in the same format. (Starts with full 10 digit date)
=IF([Date as Text Type]@row <> "", DATE(VALUE(LEFT([Date as Text Type]@row, 4)), VALUE(MID([Date as Text Type]@row, 6, 2)), VALUE(MID([Date as Text Type]@row, 9, 2))), "")
Answers
-
Carson Penticuff ✭✭✭✭✭
You will need to make sure your [Date as DateType] column is formatted as Date. This also assumes your [Date as Text Type] column is always in the same format. (Starts with full 10 digit date)
=IF([Date as Text Type]@row <> "", DATE(VALUE(LEFT([Date as Text Type]@row, 4)), VALUE(MID([Date as Text Type]@row, 6, 2)), VALUE(MID([Date as Text Type]@row, 9, 2))), "")
-
sushilp ✭✭
Thank you very much Carson. it works perfectly. Appreciate your quick help!
-
What is the purpose of the Value function, here?
-
Andrée Starå ✭✭✭✭✭✭
I hope you're well and safe!
VALUE converts the text date to a number.
I hope that helps!
Be safe, and have a fantastic weekend!
Best,
Andrée Starå| Workflow Consultant / CEO @WORK BOLD
✅了我的帖子(s)帮助或回答你的问题吗tion or solve your problem? Please support the Community bymarking it Insightful/Vote Up, Awesome, or/and as the accepted answer. It will make it easier for others to find a solution or help to answer!
SMARTSHEET EXPERT CONSULTANT & PARTNER
Andrée Starå| Workflow Consultant / CEO @WORK BOLD
W:www.workbold.com| E:[email protected]| P: +46 (0) - 72 - 510 99 35
Feel free to contact me about help with Smartsheet, integrations, general workflow advice, or something else entirely.
Categories
You would use the below for Jan 2023 and adjust the month and year numbers accordingly for each of the other months.<\/p>
=IF(AND(MONTH([Start Date]@row)<= 1, YEAR([Start Date]@row)<= 2023, MONTH([End Date]@row)>= 1, YEAR([End Date]@row)>= 2023), [$ per month]@row)<\/p>"},{"commentID":387901,"body":"
Lets try a different approach.<\/p>
=IF(AND(VALUE(YEAR([Start Date]@row) + IF(MONTH(Start Date]@row)< 10, \"0\", \"//www.santa-greenland.com/community/discussion/107086/\") + MONTH([Start Date]@row))<= 202307<\/strong>, VALUE(YEAR([End Date]@row) + IF(MONTH([End Date]@row)< 10, \"0\", \"//www.santa-greenland.com/community/discussion/107086/\") + MONTH([End Date]@row))>= 202307<\/strong>), [$ per month]@row)<\/p> Basically we are creating a yyyymm stamp from the start and end dates and comparing them to the yyyymm stamp for that year\/month combo. The above is for July 2023 (202307).<\/p>"},{"commentID":387906,"body":"
<\/p>