Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
I want the time stamp in the following format "HH:mm:ss dd/MM/yyyy", but the output is the default one, but when I use following code, the output of the code has Date First and Time next
//DateTime Format I wanted
var sdf = "HH:mm:ss dd/MM/yyyy";
// dateValue:DATETIME
var dateValue = new Date();
// dateFormat(dateValue:DATETIME,dateFormat:STRING):STRING
var formattedDate = dateFormat(dateValue, sdf);
// parseDate(stringDate:STRING,dateFormat:STRING):DATETIME
var result = parseDate(formattedDate, "HH:mm:ss dd/MM/yyyy");
But the Outout is from parseDate is 2021-08-19 13:37:32.000 instead of 13:37:32 2021-08-19
@paic @slangley @c_lowy @CarlesColl
Thanks,
Shahsi !!
Solved! Go to Solution.
Hello @pshashipreetham ,
If you are planning to display the same date format(dd/mm/yyyy instead of yyyy/mm/dd) using Grid than it can be done using Localization Tokens defined in the Default Localization table.
Regards
Bhawna
Hi @pshashipreetham ,
For converting from String to DateTime format in ThingWorx, use below line of code:
parseDate(DateInString,"yyyy-MM-dd HH:mm:ss.SSS");
Kindly revert if this works for you!
Bhawna
Hi @bchaudhary ,
Thanks for the quick response, Please Read the post again, I need the output in this format only:
var result = parseDate(formattedDate, "HH:mm:ss dd/MM/yyyy");
Thanks !!
Hi @pshashipreetham ,
As far as i know ThingWorx DateFunctions uses Joda DateTimeFormatter.
Kindly check once.
Bhawna
Hello @pshashipreetham ,
If you are planning to display the same date format(dd/mm/yyyy instead of yyyy/mm/dd) using Grid than it can be done using Localization Tokens defined in the Default Localization table.
Regards
Bhawna
Hi @bchaudhary ,
I have timestamp in the grid column, so I wanted it in the "HH:mm:ss dd/MM/yyyy", how can I do with Localization Token, I have tried but it Didn't work !!
Can you help me out over here ?
Thanks !!