jcagney
Junior Member
Posts: 2
Registered: 3/9/2010
Location: bend, or
Member Is Offline
|
| posted on 3/9/2010 at 05:03 PM |
|
|
Changing to MYSQL format - new version of TCAL
I need to get the date POSTED to my server side so I can insert it directly into a MYSQL table. Now it comes back mm/dd/yyyy.
I searched the forum and found a 2003 posting by NIK which had a solution but for Calendar1.js.
I implemented the fix as best as I could determine, but I am still getting the date returned as mm/dd/yyyy. Can someone help?
Here is what I attempted:
Finding no Calendar1.js and no code in Calendar_us.js that exactly matched the solution, I did find the // date generating function with almost the
same code:
(d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "/"
+ (d_date.getDate() < 10 ? '0' : '') + d_date.getDate() + "/"
+ d_date.getFullYear()
So I replaced it with from the solution (with minor changes):
d_date.getFullYear() + "-" + (d_date.getMonth() < 9 ? '0' : '') + (d_date.getMonth() + 1) + "-" + (d_date.getDate() < 10 ? '0' :
'') + d_date.getDate()
Any suggestions please? This is the ideal script for me if I can get it to do this? A php suggestion for translating the mm/dd/yyyy to yyyy-mm-dd
for MYSQL would be a perfectly happy answer.
|
|
|
jcagney
Junior Member
Posts: 2
Registered: 3/9/2010
Location: bend, or
Member Is Offline
|
| posted on 3/9/2010 at 07:23 PM |
|
|
Somewhat solved
I do this to the date on the client side:
$pieces = explode(" ", $DateDate);
$new_date = date("Y-m-d",strtotime($pieces[2]." ".$pieces[1]." ".$pieces[0]));
|
|
|