[Custom Masks] How to format date time?

[Custom Masks] How to format date time?

  
Forge Component
(25)
Published on 14 Nov (4 weeks ago) by Caio Santana Magalhães
25 votes
Published on 14 Nov (4 weeks ago) by Caio Santana Magalhães

Does it support date time formatting? It will behave strangely when time format is set.

Can you help?

Solution

Hi Eric,

The CustomMasks will let you format date time, but there is a catch. 

The OutSystems platform has a default DataTime format which can be set in ServiceCenter. This is the format OutSystems expects when entering a date time in an input. When your mask is requiring a different format, you have to have a variable with type Text in order to get the correct value. In the action that uses the date time, you have to change the Text variable into a Date Time variable in order for OutSystem to understand the Date Time value. In the preparation of your screen you have to have an action that converts the Date Time into the Text including the correct formatting for the custom mask to understand.

Kind regards,

Remco Dekkinga


Solution

Hi Eric,

In out systems you can do data format in below ways.

1. 

FormatDateTime(value,format)DateTimeToDate()
DateTimeToText()
DateTimeToTime()
DateToDateTime()
DateToText()
TextToDate()
TextToDateTime()
TextToDateTimeValidate()
TextToDateValidate()


Date_PrettyFormat(Date),
DateTime_PrettyFormat(DateTime)

this is the function provided by outsytesms,

2.   you can configure data format form service center (administration tab)

3.   If all above formats doesn't helps your need.. Just write an extension which will take care of your fomat..


Thanks,

Rocky

Instead of dd-mm-yyyy , I want mm-dd-yyyy. Is it possible?

Hi Devjyoti,

Yes it is possible. MaskDate has 1 input called DateFormat and you can set the format you want.

Regards,

Marcelo


Marcelo Ferreira wrote:

Hi Devjyoti,

Yes it is possible. MaskDate has 1 input called DateFormat and you can set the format you want.

Regards,

Marcelo


Hi Marcelo , thanks for the reply.

Can you please tell me the steps.


Check this:

Regards,

Marcelo

Marcelo Ferreira wrote:

Check this:

Regards,

Marcelo

Hi Marcelo,

Is it only for Web or its for Mobile also ?


Is only for web. For mobile try this one https://www.outsystems.com/forge/component/2258/input-masks-mobile/

Regards,

Marcelo