Hi All,
I am using jquery datepicker which takes date in mm-dd-yyyy format, now once user chooses & submit the form I need to convert it's format into yyyy-mm-dd format(mysql-format),
Please suggest how I can make this?tried google but not getting clear idea how to do this.
Thanks in Advance!!
Php Date Problem!!
Moderator: General Moderators
Re: Php Date Problem!!
I suggest MySQL function if you need it for insert to DB:
otherwise it could be
Code: Select all
SELECT STR_TO_DATE('01-31-2010','%m-%d-%Y') Code: Select all
<?php
list($month,$day,$year) = expldoe("-",$date);
$newDate = $Y."-".$month."-".$day;
?>-
pavanesh2009
- Forum Commoner
- Posts: 30
- Joined: Wed Jan 13, 2010 7:24 am
Re: Php Date Problem!!
Thanks dejvos for help,
Someone told me about php date function & I used it in my script now it works like a charm.
But now I want to filter some records by date (i.e. a duration of week or month), Any idea on this?
Thanks once again!!
Someone told me about php date function & I used it in my script now it works like a charm.
But now I want to filter some records by date (i.e. a duration of week or month), Any idea on this?
Thanks once again!!
dejvos wrote:I suggest MySQL function if you need it for insert to DB:
otherwise it could beCode: Select all
SELECT STR_TO_DATE('01-31-2010','%m-%d-%Y')
Code: Select all
<?php list($month,$day,$year) = expldoe("-",$date); $newDate = $Y."-".$month."-".$day; ?>