Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

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

So if I used that code, what part of it is customizable. "parts" is the name of the variable so I could keep it the same or change it as long as a changed in the next line too. That wouldn't necessarily matter though would it? So I guess by process of elimination, I probably have to change something in "-", but what does that even mean?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

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

Hi Ellen,

You can not use this code without understanding what you do... So it's necessary to learn following topics:

So please read more about "split" functionality: http://www.w3schools.com/jsref/jsref_...

Also here used "+" operator, here is details: http://www.w3schools.com/js/js_operat...

And arrays, here is details: http://www.w3schools.com/js/js_arrays...

Then if you will have any further question about JS custom implementation you can find them in internet.

Regards.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

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

var parts = value.split(" ",3);
return parts[1] + "-" +parts[2] + "-" +parts[0];
return value.split(" ")[0];

or would this be better

var parts = value.split(" ",3);
return parts[1] + "-" +parts[2] + "-" +parts[0];
var ellen = parts[1,2,0]
return value.split(" ")[0];

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

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

Hi Ellen,

It's up to you what implementation would be better for you,

But i guess you some some strange in your code:
http://prntscr.com/5hpfpt/direct

Regards.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

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

I tried the top and it didn't work. Is there something I missed?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

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

Try this code:

pre

var parts = value.split("-");

return parts[1] + "-" +parts[2] + "-" +parts[0];

/pre

Regards.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

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

Ok,

that was just suggestion of custom code.

Please use your custom implementation witch will work.

Regards.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

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

What should I replace value with? In the examples on the website provided, it had a variable that equaled a string. But in my case I do not have a variable because it is in the database and it isn't a string, it is numbers(or a date?).

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

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

HI Ellen,

Please make investigation about what value you have there.

Use console.log for this goal.

More info here: https://developer.mozilla.org/en-US/d...

Regards.

Return to “Issues”