Parsing text to date format

Duc Thang TRAN
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2025

Hello Every one , 

I'm looking for a solution to convert a text field into a date-time format.

For example, I have a Text 3 field with a value like: 12/02/2025 13:51:21.

I need a smart value that can save this value into a date-time field. The default format on my instance is dd/MMM/yyyy h:mm a.

I'm using .toDate, but it’s not working until I change my text field value to 12/Feb/2025. Do you know a way to convert a text field when its format differs from the instance's default date format?

1 answer

1 accepted

2 votes
Answer accepted
Vishal Biyani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2025

@Duc Thang TRAN 

with toDate you need to specify the format. Are you doing that?

Once string is converted to date, use .format to update the date format

.toDate("yyyy-MM-dd").format("MM/dd/yyyy H:m:s ")

Duc Thang TRAN
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2025

@Vishal Biyani 

Finnaly i'm able to using this smart value and save to date time field 

.ToDate("dd/MM/yyyy HH:mm:ss")

 

Vishal Biyani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2025

Good to know that this worked for you

Suggest an answer

Log in or Sign up to answer