Hi,
When I get data using RestXpress my dates are being returned as 2013-06-23 00:00:00 - is there an easy way to present the results as 23/06/2013 ?
Thanks
Andrew
Hi,
When I get data using RestXpress my dates are being returned as 2013-06-23 00:00:00 - is there an easy way to present the results as 23/06/2013 ?
Thanks
Andrew
Hello! Try this code
codevar newDateFormat = $.datepicker.formatDate('dd/mm/yy', new Date("2013-06-23 00:00:00"));/code
Hi Marina,
In which part of Appery should I put this?
Andrew
It depends on what you are going to do after you get service results. If you want to map result to some component, you would need to add codereturn $.datepicker.formatDate('dd/mm/yy', new Date(value));/code in mapping JS
This should help http://docs.appery.io/documentation/a...
Hello,
I have a very similar question and I cannot solve it using the information provided, can you help?
what I am trying to do: I would like the appery backend defined date (UTC I think) to display as Month, Day, Year (or any other format). I placed the above coding (using both scripts together, and also just the first JS script from Marina) and the page breaks, so I am not doing this correctly.
I have placed this JS code into the "add JS" field in the data mapping page in appery. I have the appery backend date mapping to a specific component (in a frame) on one of my pages. can someone please tell me how to do the following:
add JS to somehow format the appery date output into a field that I have mapped appery backend dates into?
thank you.
Hello! Firstly look at a similar question https://getsatisfaction.com/apperyio/...
If doen't help, please share screen shot of the mapping where you add JS?
thanks so much for the quick reply. so I am not using a datepicker, but rather the date formatting is coming out of appery backend, in UTC format
I have debugged and it says the following:
--------$.event_Date is undefined
for ( ; i < len; i++ ) {
am I inserting the wrong JS or in the wrong place or both? I am so grateful for your help!!!
here are the screenshots of what I am trying to do (my project is already shared with appery support):
Hi,
You would need to add Datepicker component to your page. This component has functions to format the date and parse the string in a date format.
In response mapping (your first screenshot), the JavaScript code (second screenshot) does not work with the return value. That is, your code in the second screenshot does not work for two reasons: formatDate as a function does not exist in your application and you can not assign a value to the component using return.
To do this after you add Datepicker to the page (you can hide it with a flag Visible), replace the code in your second screenshot with the following:
precode$(element).text(
$.datepicker.formatDate(
'dd/mm/yy', // use your format here
$.datepicker.parseDate(
'!!FORMAT OF YOUR DATA!!', value
)
)
);
/code/pre
You can find information about formatting date here: http://api.jqueryui.com/datepicker/
Thank you so much Katya. I am able to map the date into the datepicker and display it. However, I am so sorry I am still struggling with two things, can you please help? you have been SO HELPFUL thank you!!:
how do I map the text in the datepicker to the label I have created that is visible? I have provided a screenshot where I would like to map the hidden datepicker output.
how to actually format the date - either directly in the datpicker (hidden), or in the label where I would like the date to display. can you please tell me exactly where to put that code?
I am currently placing the above code in the JS in the data mapping for "date format" but the page keeps breaking. I have provided a screenshot here as well.
this is the code I am using in the JS field for "date format"
$(element).text(
$.datepicker.formatDate(
'D, M d yy', // my format
$.datepicker.parseDate(
'D, M d yy', value
)
)
);
Hello! Sorry for delay. I'll update.