Datetime conversion to Time
Question
Application Type
Mobile

Hi ,

I am consuming rest and in one field is datetime. The data is text and value is like DD/MM/YYYY HH:MM:SS

I need to convert it into HH:MM please suggest how I can do

Hi Vivek,

check this post, it talks about FormatDate() function:

https://www.outsystems.com/forums/discussion/42530/date-format/

Hi,

I checked this but suppose my date is 20/04/2021 03:00:00 and data type is text

then when I am using formatedatetime then it is giving me value 01-01-1900

If it is a text you have 2 options:

  • Select the piece of text with Substr(Date,11,5)
  • Use FormatDate() after converting TextToDateTime()
    • FormatDate(TexToDateTime(Date),"hh:mm")

Hi Vivek,

Please try this and see if it fits to your use case.

FormatDateTime(TextToTime("20/04/2021 03:00:00"),"hh:mm")


Hi Vivek ,

Please let us know if any of the solution worked for you.

Thanks,

Vani


Hi Vivek,

First you need to convert text to date and then you can use FormatDateTime function for get date in required format

Hello @Vivek Pandurang Pandile 

If you are saving that DateTime as a text, you can use the substring function like this:

Substr(DateToConvert,11,5)


Original value: 

20/04/2021 03:00:00

Converted value using substring

03:00


Regards

Gonçalo Almeida

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