80
Views
8
Comments
Solved
Get current date time in ISO format

In data action, I need to call API that need date time in ISO format. Is there any way for me to convert or get current date time in iso format?

2024-10-19 11-15-19
Sazid
Solution

It is FormateDateTime function you will need to use. i have uploaded oml which displays ISO formate.

DateTime_ISO.oml
2021-11-19 11-12-44
Rui Mendes
Solution

As mentioned by others earlier, to convert the current time to ISO 8601 format in OutSystems, you should use the following expression: 

FormatDateTime(DateVariable, "yyyy-MM-ddTHH:mm:ssZ")

Important:
Always use the format "yyyy-MM-ddTHH:mm:ssZ" to ensure the correct ISO 8601 representation. 

This will help you format your date properly for API calls or other requirements.

If you have any further questions, feel free to ask!

If this format works for you, please mark it as a solution. This will help others with the same issue find the solution more easily. 

2021-03-08 09-24-09
Rúben Meireles

Hi Muhammad,

What type of API you need to call? If is a REST API you can define the date format here:

Cheers,

Rúben

UserImage.jpg
Muhammad Faiq Roslan

I need to pass the parameter on POST. The parameter for DateTime need to be converted to ISO format.

2021-03-08 09-24-09
Rúben Meireles

The platform will do that for you automatically :)

You just need to have your parameter with the data type Date Time

2024-10-19 11-15-19
Sazid

you can use something like following to conver datetime to iso format 

CurrDateTime = CurrDateTime() 

IsoDateTime = DateTimeToText(CurrDateTime, "yyyy-MM-ddTHH:mm:ss") 

UserImage.jpg
Muhammad Faiq Roslan


I cant use the function you mention as it only accept 1 parameter

2024-10-19 11-15-19
Sazid
Solution

It is FormateDateTime function you will need to use. i have uploaded oml which displays ISO formate.

DateTime_ISO.oml
2023-01-26 16-03-24
Ana Agostinho

Hello Muhammad, 

I believe what you are looking for is the FormatDateTime() function. 

You can check the documentation page, which has some examples: 

Best regards, 

Ana

2021-11-19 11-12-44
Rui Mendes
Solution

As mentioned by others earlier, to convert the current time to ISO 8601 format in OutSystems, you should use the following expression: 

FormatDateTime(DateVariable, "yyyy-MM-ddTHH:mm:ssZ")

Important:
Always use the format "yyyy-MM-ddTHH:mm:ssZ" to ensure the correct ISO 8601 representation. 

This will help you format your date properly for API calls or other requirements.

If you have any further questions, feel free to ask!

If this format works for you, please mark it as a solution. This will help others with the same issue find the solution more easily. 

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