I have this date format: 2011-09-28 18:01:00 (in varchar), and I want to convert it to datetime changing to this format 28-09-2011 18:01:00. How can I do it?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
This web has some good examples to convert any varchar to date or datetime
As has been said, datetime has no format/string representational format.
You can change the string output with some formatting.
To convert your string to a datetime:
Gives:
To convert that to the string you want:
Gives:
this website shows several formatting options.
Example:
Try the below
You could do it this way but it leaves it as a varchar
or