Jose6594145
Posts: 0
Joined: Mon Jan 20, 2014 9:24 pm

Time format

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

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Time format

Hi Jose -

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

Jose6594145
Posts: 0
Joined: Mon Jan 20, 2014 9:24 pm

Time format

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..

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Time format

Hi Jose,

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

Jose6594145
Posts: 0
Joined: Mon Jan 20, 2014 9:24 pm

Time format

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

Jose6594145
Posts: 0
Joined: Mon Jan 20, 2014 9:24 pm

Time format

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Time format

Jose,

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

Jose6594145
Posts: 0
Joined: Mon Jan 20, 2014 9:24 pm

Time format

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Time format

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

Return to “Issues”