Page 2 of 6

DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Fri Jun 20, 2014 9:16 pm
by Kateryna Grynko

Hi Alyssa,

Do you mean updating a Database record (http://devcenter.appery.io/documentat...) or a Datepicker component(http://stackoverflow.com/questions/16...)?


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Sat Jun 21, 2014 12:04 am
by Alyssa Rolfe

Im not sure what would be the better way to do it. When the date is recorded into the database it also includes the time stamp as part of the ISO formatting. This would be fine if it was just stored this way...but on the user end, I don't want the time displayed....just the date.

This is probably an easy thing to fix, Im just not sure how to go about it.

Thanks.


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Mon Jun 23, 2014 4:20 pm
by Alyssa Rolfe

Image

Maybe this screen shot helps.
I used the above code in my mapping to get the data to save into the database. That works great now, but I do not need the time portion. How to I not save it or just simply not show it at the final user end?

I just want it to show the date and if possible in the MM/DD/YYYY format.

Thanks!


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Mon Jun 23, 2014 4:48 pm
by Evgene Karachevtsev

Hello Alyssa,

Add this JS on mapping for response parameter which contains a date:

codereturn value.split(" ")[0];/code

This will display a date without a time.


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Mon Jun 23, 2014 5:53 pm
by Alyssa Rolfe

Thank you so much!

This is exactly what I needed, worked perfect.


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Thu Oct 09, 2014 3:45 am
by nica faustino

Hi,
Although I understand that the date picker and DB formats don't play very well together, I wonder if there is a simple solution to hundreds of web threads related to this topic.

My page has a date picker with date format dd/mm/yy. (e.g. 13/10/2014)
My DB has a column "date" with date format yyyy-mm-dd (e.g. 2014/10/13)

I have a createAttendance service where Attendance is a good name for my attendance tracker App.

On the Before Send service, I mapped the date picker to the DB date and all other screen elements and the DB columns.

Finally, I added the JS code shared by Oleg on this thread (e.g. var parts = value.split("/");
return parts[2] + "-" +parts[1] + "-" +parts[0];

to the date element/column.

HOWEVER, my DB still doesn't save the date! :-(

I have included an alert ( value ) on my JS code and it shows 13/10/2014 (correct!)
I have included a second alert ( newVariable ) that I created instead of returning the parts array directly and it shows 2014-10-13 (correct!).

HOWEVER, my DB still doesn't save the date! :-(

I have prayed, cried, slept, woke-up, and my DB still doesn't save the date! ;-)

Any help would be much appreciated.

Thanks, in advance, for your help.
Time to sleep again... 4:45a.m.


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Thu Oct 09, 2014 11:44 am
by Evgene Karachevtsev

Hello Gabriel,

Please detail, have you seen what goes in the service and what it returns? Maybe the problem is not in the date but in something else? http://devcenter.appery.io/documentat...


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Thu Oct 09, 2014 12:06 pm
by nica faustino

Evgene,
Did you mean to ask me (Nica Faustino)? I believe Gabriel already said it worked for him.

Unfortunately, mine isn't working yet...


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Thu Oct 09, 2014 12:16 pm
by Evgene Karachevtsev

Nica,

Sorry for misunderstanding, yes, this question was for you.


DatePicker date will not add to a database. How do I format datepicker date to make the DB happy?

Posted: Fri Oct 10, 2014 10:59 am
by Evgene Karachevtsev

Nica,

Could you please detail, do you have any update with your issue?