Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Extracting Date from Text Field

Hi,

I've got a Text field and want to extract a Date from it. My text field has blank values or Date in format "DD/MM/YYYY" or even time like "DD/MM/YYYY Time". I want to extract the date form it in the format DD/MM/YY.

 

I tried this formula 

```

Legend = IF (Database[Date Text column]<>BLANK(), IFERROR(DATE(YEAR(Database[Date Text column]),MONTH(Database[Date Text column]),DAY(Database[Date Text column])),BLANK()),BLANK()) //Converting Text field to Date
```
However, this gives the new column as Text as well and I am unable to convert the type to Date.
Any suggestions are welcome. Please help!

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi tamerj1 

     

    It shows an error that 'Cannot convert type '' Text to Date type'.

    But I was able to solve the problem by using the formula:

    ------------------------------------

    Legend = IF (Database[Date Text column]<>BLANK(), IFERROR(DATE(YEAR(Database[Date Text column]),MONTH(Database[Date Text column]),DAY(Database[Date Text column])),BLANK()),BLANK()) //Converting Text field to Date

    -----------------------------------------

    and then converting the Data Type to 'Date' in Column Tools tab.

     

    Thanks a lot for your help! I really appreciate it!

2 Replies

  • tamerj1's avatar
    tamerj1
    Community Champion

    Hi Anonymous 

    you can try DATEVALUE function:

    DATEVALUE ( Database[Date Text column] )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi tamerj1 

       

      It shows an error that 'Cannot convert type '' Text to Date type'.

      But I was able to solve the problem by using the formula:

      ------------------------------------

      Legend = IF (Database[Date Text column]<>BLANK(), IFERROR(DATE(YEAR(Database[Date Text column]),MONTH(Database[Date Text column]),DAY(Database[Date Text column])),BLANK()),BLANK()) //Converting Text field to Date

      -----------------------------------------

      and then converting the Data Type to 'Date' in Column Tools tab.

       

      Thanks a lot for your help! I really appreciate it!