0

I want to convert text value into date . Text field contain value= 21-FEB-2022

DATE() function is not working as value is not in proper format

2 Answers 2

2

You'd have to translate the month into a number:

DATE(
  VALUE(RIGHT(Field__c, 4)), // year
  CASE(MID(Field__c, 3, 3), 
    'JAN',1,'FEB',2,'MAR',3,'APR',4,'MAY',5,'JUN',6,
    'JUL',7,'AUG',8,'SEP',9,'OCT',10,'NOV',11,12),
  VALUE(LEFT(Field__c,2)
)
-1

Use DATEVALUE() to convert into Date. It returns a date value for a date/time or text expression.

Refer this link : Convert to Date Format

1
  • This would require the text to be "2022-02-21" instead of "21-FEB-2022".
    – Derek F
    May 6 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.