Page 1 of 2

Time format

Posted: Thu Jan 23, 2014 11:24 pm
by Jose6594145

Hi, I'm trying to display date and time using javascript just after a text label mapped REST response using this script,
return $.datepicker.formatDate('dd/mm/yy hh:mm:ss', new Date(value));

and I'm not getting the correct time:
22/01/2014 hh:01:ss

what am I missing?

Thanks in advance,
Jose


Time format

Posted: Thu Jan 23, 2014 11:35 pm
by Illya Stepanov

Hi Jose -

Please take a look here, let us know if it helps:
:: https://getsatisfaction.com/apperyio/...


Time format

Posted: Fri Jan 24, 2014 9:09 am
by Jose6594145

Thanks for the reference, but I still do not see how to format the time (the date it's ok and working for me).. How can I specify the time in HH:MM:SS format? I did not find a concrete spec in the documentation for that..


Time format

Posted: Fri Jan 24, 2014 10:57 am
by Kateryna Grynko

Hi Jose,

Datepicker component doesn't work with time. You would need to implement this.


Time format

Posted: Fri Jan 24, 2014 10:33 pm
by Jose6594145

Thanks for the tip. I might be wrong because my programming skills are limited, but I think I'm not using datepicker, I'm just trying to format a date string coming from the DB into a text label component. In case that make sense, would it be a chance to find a workaround for my issue. Again, sorry if I'm not right in my analysis and thank in advance for the support.
Jose


Time format

Posted: Fri Jan 24, 2014 11:52 pm
by Alena Prykhodko

Time format

Posted: Sat Jan 25, 2014 12:36 am
by Jose6594145

Sorry I'm not finding anything specific for this case there, it only says that "The Date type value is a string which contains a UTC timestamp stored in ISO 8601 format with millisecond precision: YYYY-MM-DDTHH:MM:SS.MMMZ."
I guess the only way is to parse the string via javascript, I just wanted to check with you if there was a easier/obvious way to do that, but I guess it's not the case.
Thanks anyway,
Jose


Time format

Posted: Sat Jan 25, 2014 12:44 am
by Alena Prykhodko

Jose,

Do you use Datapicker component https://getsatisfaction.com/apperyio/... ?


Time format

Posted: Sat Jan 25, 2014 5:06 pm
by Jose6594145

Datepicker component seems not to work with time. As I said before I was just trying to understand if there was an obvious way handle that before parsing the ISO 8601 string coming from the REST response.
Jose


Time format

Posted: Mon Jan 27, 2014 9:56 am
by Maryna Brodina

Hello! Sorry for a late reply. Date object doesn't have an option in JS to format the date according to the template. Datepicker doesn't work with time. The workaround is to write your own function for date formatting, but taking into account that you need minimal changes (replace "-" with "/" and delete miliseconds) you can just do this replacement in string with no need to parse anything prereturn value.slice(0,-4).replace(/-/g, "/");/pre