Hi,Use FormatDateTime(LocalVariableName, "yyyyMMHHmmss")
Regards,
Daniel
Hi @Dilmi Amarasingha ,
The Date data type in OutSystems doesn't store time (HHMMSS). It only stores the calendar date. If your variable actually contains a time value, it is most likely a Time or DateTime, not a Date.
If it's a DateTime, you can use:
FormatDateTime(YourDateTime, "HHmm")
This returns a Text value such as 0930 or 1745.
If it's a Time value, you can first convert it to a DateTime (or use the appropriate formatting function available in your OutSystems version) and then format it using "HHmm".
If your variable is truly of type Date, there is no time component to extract, so you won't be able to produce an HHmm string from it. In that case, you should verify the data type of the input variable.
If anything comes up, please provide us with more information so we can help you.
I want the input widget to allow users to enter only the time, without the date.
If the goal is for the field to accept only a time value, bind the Input to a variable of type Time instead of DateTime.
When the Input is bound to a Time variable, OutSystems treats the value as a time and, on supported platforms, displays a time picker.
If your source value is a DateTime, use the following function: DateTimeToTime()
Hi @Dilmi Amarasingha
You can achieve this by using the FormatDateTime() function before saving the value to your Text attribute.
In the Assign node, use:
Source.StartTime = FormatDateTime(StartTime, "HHMM")
The FormatDateTime() function returns a Text value, so it can be stored directly in a Text attribute. Using the "HHMM" format will convert the Time value (HH:MM:SS) into the desired HHMM format (for example, 0930 or 1545).
I hope this helps!
Hi.
You can use FormatDateTime(TimeVar, HHmm).
Hi
Only use FormatDateTime to change format (FormatDateTime(TimeVar, HHmm)) and save it text field
Hello @Dilmi Amarasingha,
Replace(FormatDateTime(LocalVariable_Time, "HH:mm"), ":", "")
How it works:
FormatDateTime(YourTimeLocalVar, "HH:mm"): OutSystems formats the Time variable into a standard string like "14:30".
Replace(..., ":", ""): Removes the colon (:), turning "14:30" into the 4-character string "1430".