Date time conversion to only time
Question
Application Type
Reactive

Hi All,

I'm new in outsystem working on a scenario where I need to show only the time instead of DateTime. 

The Datetime I'm getting from the database and same I'm saving this into the exported/downloaded file in the below format 

2021-09-18 13:02:57

And in the UI I'm showing the datetime in this way 


Sat, 18 Sep 2021 13:02:57 GMT


Actually I'm converting that datetime parallelly. So here It's asking me to change the JourneyDate data type in text So I'm done the below changes

ConvertUTCDateTime(TextToDateTime(FormatDateTime(JourneyDate,"hh:mm tt")))

But This case is also not working for me.

I wanted to show only the time not along with the date. Any idea or help will be appreciable.

Thanks 

Prince

Hi,

You can use the built-in function: FormatDateTime(). The following example for showing time:

FormatDateTime(Datetime,"HH:mm:ss")

Hope this helps,

Khuong

Thanks for the reply Khuong, 

ConvertUTCDateTime(FormatDateTime(JourneyDate,"hh:mm tt"))

Actually I'm converting that datetime parallelly. So here It's asking me to change the JourneyDate data type in text So I'm done the below changes

ConvertUTCDateTime(TextToDateTime(FormatDateTime(JourneyDate,"hh:mm tt")))

But This case is also not working for me.

Please advice me any other way for this.

Hi,

I guess the input parameter for ConvertUTCDateTime is a Datetime type right?

If so, you can convert first then FormatDateTime after. Like this:

FormatDateTime(ConvertUTCDateTime(JourneyDate),"hh:mm tt")

Or If JourneyDate is a text then you need to covert it to Datetime first. Like this:

FormatDateTime(ConvertUTCDateTime(TextToDatetime(JourneyDate)),"hh:mm tt")

Find the image for the reference.

The JourneyDate is in DateTime datatype but while converting it is expecting this in Text DataType.

I have tried with both scenario which you have mentioned above.

Thanks 

Prince

img.PNG

Hi Prince,

Can you capture/share the ConvertUTCDateTime function. Is it your own function or from an extension?

Best,

Khuong

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.