Hi i have an one issue i need to convert the date and time values with help of build in function
the date and time is text "Fri,07Oct202200:45:27GMT" i need to convert to this format in the data type as date time month/date/year HH:MM:SS
thanks and regards
karthick
As you mentioned it was returning null value, I tested it. Firstly in the last line you don’t need “/”, corrected it
TextToDateTime( Substr(Substr(Var1,4,Length(Var1)),0,2) +"/" +Substr(Substr(Var1,4,Length(Var1)),2,3) +"/" +Substr(Substr(Var1,4,Length(Var1)),5,4)+ " " +Substr(Substr(Var1,4,Length(Var1)),9,8) )
Second, noticed a behaviour. If we do conversion all at once in assign, eg Var2 (date time data type) - this returned me null value
However if I do in two step, eg– Var1(text data type) get the value from below Then in second step do text to date time conversion Var3(date time data type) - this result gave expected outcomeResult - message one is Var2 and in expression highlighted is Var3.
You can try this and see if you get the value now after conversion.
i have used like this Substr(Value.Last_update,2,Length(Value.Last_update))
its right can you help me fix this issue
Hello Karthick, You can create a function that uses the Substr built-in function and allows to retrieve the date time, assuming the text will always be in the same format.
After having the day, month, and year separately, you can concat and create the text expression which is allowed to be converted into DateTime by this built-in function:
Basically, you just need to play around with Built-in functions. :)
Best regards,
Ana
Hi @Karthick Balaji ,
Also you can use Javascript like this,
Then use FormatDateTime().
Thanks
inside the server action we cannot able to use the script so only i am like to do it in build in functions
it actual working good even i am also tried that use of substr() but after removing the unwanted thing in the text that date and time after that i am trying to use the data conversion like, main thing is this values comes from API. i am converting the text to date time with some changes.
TextToDateTime(Substr(Substr(Value.Last_update,4,Length(Value.Last_update)),0,2) +"/"+Substr(Substr(Value.Last_update,4,Length(Value.Last_update)),2,3) +"/"+Substr(Substr(Value.Last_update,4,Length(Value.Last_update)),5,4)+ "/"+Substr(Substr(Value.Last_update,4,Length(Value.Last_update)),9,8))
but i am getting empty values like this
{
"status": "SUCCESS",
"message": "AllGood!",
"data": {
"ParentCollection": [
"CollectionId": 50,
"Device": [
"sn": "100941",
"online": 0,
"last_update": "1900-01-01 00:00:00"
},
"sn": "100945",
"sn": "100967",
}
]
"CollectionId": 52,
"sn": "100989",
"sn": "101001",
TextToDateTime conversion accepts the text in a certain format which is why I mentioned that you need to get the month number from name then arrange in given format then do conversion.
okay can you help me for one more thing if i am passing the request some of the parameters are null default outsystems ignore the null values but i need that null values in response how we can achieve this @Puja Rani i have tried some default values -9 also but incase i need to store the response to entity means it wrong right can you help me for this one.
@Puja Rani thanks for you reply
i have tried that but still i am not able get that can you see once that my OML file in newcustomiziation
karthick after deserialize the device list list append.
Instead of append all , if try do to using for each loop and that two step local variable for data type conversion, if you can check this way.
i have get that values but instead of - this i need / this for separator
ok, good to hear your problem is solved :)