Store multiple dates in database using datetimepicker

I’ve been trying to use this datetimepicker link
and i want to store each date that i have chosen to a table named “testtable” with column names
id and dates as a one line.

here’s an example of the date I’ve selected and in the database it should look like this

how do i do it?Thanks in advance.

Have you read the documentation?

You have some properties and methods there. I guess the easiest thing to do would be to get the value properties and use it in a INSERT INTO query that will store the date in your database

yea i`ve done that but the problem is when I insert the data the result will look like this

btw i inserted those values earlier manually

[quote=“nvrmnd1, post:3, topic:216580, full:true”]
yea i`ve done that but the problem is when I insert the data the result will look like this [/quote]

then you did it wrong :wink:

it should look like this –

INSERT INTO testtable (monthentries) VALUES ( '2016-02-27' ) , ( '2016-02-28' ) , ( '2016-02-29' )

If the property “value” returns an array of dates picked (which could be possible, depending on how you set the maxpick option) then you would need to use text functions to be able to insert each day in just one row.

I have this as my php code

and the result is this

You should use PHP’s explode function using the comma as delimeter.

As I said, if you want to divide the array you receive into single values, you’ll need to use string functions

explode does precisely that.

Check PHP’s documentation

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.