Link to home
Start Free TrialLog in
Avatar of roscoeh23
roscoeh23

asked on

Converting a Uk date to a mysql date

I have my dates in this format

DD/MM/YY

I need to convert it to mysql DATE  YYYY-MM-DDformat and back again.

In the past I have done this manually but is there a built in function for PHP or MYSQL to do this?

R.
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sailo100
Sailo100

$mysql_date = date("Y-m-d", strtotime($uk_date));
$sql = "UPDATE yourtable SET yourdatefield = '$mysql_date' WHERE ... ";

$sql = SELECT yourdatefield FROM yourtable WHERE ... ";
$uk_date = date("y/m/d", strtotime($mysql_date));