Alyssa Rolfe
Posts: 0
Joined: Fri Jun 20, 2014 12:48 pm

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

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.

Alyssa Rolfe
Posts: 0
Joined: Fri Jun 20, 2014 12:48 pm

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

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!

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

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.

Alyssa Rolfe
Posts: 0
Joined: Fri Jun 20, 2014 12:48 pm

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

Thank you so much!

This is exactly what I needed, worked perfect.

nica faustino
Posts: 0
Joined: Tue Oct 07, 2014 11:57 am

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

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.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

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

nica faustino
Posts: 0
Joined: Tue Oct 07, 2014 11:57 am

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

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

Unfortunately, mine isn't working yet...

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

Nica,

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

Nica,

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

Return to “Issues”