Question
How to format date from input=20240726 to output=26-07-2024
I have a requirement to convert Date in format 20240726 to 26-07-2024 . how can we achive this?
Note:
1) input is date type: 20240726 and output 26-07-2024 is also should be in date type after converting.
eg: input property name : TestDate consists value 20240726
i tried to convert using pxFormatDateOnly [@pxFormatDateOnly(.TestDate,"yyyyMMdd","dd/MM/yyyy")]
so by using this the date converted into 26/07/2024 but when i try to save the value to TestDate property again it says that 26/07/2024 is not valid date property since it was string. so after conversion also it should be in date format only.
-
Reply
-
A dateonly property cannot have special chars. So you need to convert the property type to text. Else you can display the formatted value on the UI, but backed save as yyyyMMdd
agree, we can format on UI .But just wanted to know is this possible with java on Edit input (property)?
Thanks
You can refer this post its clearly mentioned here
@pxFormatDateOnly(Param.Date,Param.CurrentFormat,Param.ToFormat) this will convert into string data type is there a way it converts into date data type?
What exactly is your requirement, here you can use the existing Date control and give the format as you required to display on screen . PFA
as @SohamM95 mentioned in the backend it will not be stored with special chars it will be always yyyymmdd for date and GMT format for Date time
i am not using in UI . i was trying to append the datestring to date property. can u see the attached ss below.
Thanks
@pavankillada i think when the date string is assigned to a date property, it should be changed to date. Pls try that out
@pavankillada I misunderstood. in this case, as nagarjuna suggested, try using the UI control