I couldn't find anywhere to ask this question and i'm working with PHP so i thought i would ask it here.

What would be the SQL statement to modify a database field from 'YYYY-MM-MM' to 'DD-MM-YYYY'.

Thanks,

Recommended Answers

All 3 Replies

You can use PHP function to convert 'YYYY-MM-DD' to 'DD-MM-YYYY' :

function convertDate($date) {
 	
          $new = explode("-",$date);
          $a=array ($new[2], $new[1], $new[0]);
 
          return $n_date=implode("-", $a);
 }

- Mitko Kostov

Thanks guys, both of those methods should be able to acieve what i need.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.