Page 4 of 6

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

Posted: Fri Dec 12, 2014 2:02 pm
by Ellen Schlechter

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?


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

Posted: Sun Dec 14, 2014 11:39 pm
by Yurii Orishchuk

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.


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

Posted: Tue Dec 16, 2014 5:19 pm
by Ellen Schlechter

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];


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

Posted: Wed Dec 17, 2014 2:03 am
by Yurii Orishchuk

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.


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

Posted: Wed Dec 17, 2014 5:18 am
by Ellen Schlechter

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


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

Posted: Wed Dec 17, 2014 5:40 am
by Yurii Orishchuk

Try this code:

pre

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

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

/pre

Regards.


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

Posted: Wed Dec 17, 2014 2:10 pm
by Ellen Schlechter

That didn't work.


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

Posted: Wed Dec 17, 2014 11:15 pm
by Yurii Orishchuk

Ok,

that was just suggestion of custom code.

Please use your custom implementation witch will work.

Regards.


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

Posted: Thu Dec 18, 2014 3:57 am
by Ellen Schlechter

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


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

Posted: Thu Dec 18, 2014 5:48 am
by Yurii Orishchuk

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.