141
Views
4
Comments
Solved
FormatDateTime
Question

I'm trying to work the date field so that it returns the following results:

when the value in the entity is null: " - "


when returning a value from the entity bring the following format:    "14 Dec 2022 4:26"


I'm using a ternary If in the following example:  
if(Get Entity.Date <> NullDate(), GetEntity.Date, " - ")

2022-08-03 04-32-50
Ravi Punjwani
Solution

Hi Fabiano,

From your code it seems you're using Date datatype instead of requiring a DateTime as seen from the format of value you need.

Inside the true branch of your turnary IF, just use FormatDateTime built-in function to display the value in your specific format.

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Format#FormatDateTime


UserImage.jpg
Fabiano Ferreira 

Esqueci de colocar o time mas no código coloquei, essa solução funcionou no meu código, obrigado!

2026-01-03 13-44-38
Erwin van Rijsewijk
Champion

Hi Fabiano, what is exactly your question ?

2022-08-03 04-32-50
Ravi Punjwani
Solution

Hi Fabiano,

From your code it seems you're using Date datatype instead of requiring a DateTime as seen from the format of value you need.

Inside the true branch of your turnary IF, just use FormatDateTime built-in function to display the value in your specific format.

https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Format#FormatDateTime


UserImage.jpg
Fabiano Ferreira 

Esqueci de colocar o time mas no código coloquei, essa solução funcionou no meu código, obrigado!

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

@Fabiano Ferreira da Silva Pinto 

Please translate your replied to English before posting.

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