Default MySQL DATE Column is in '2012-07-18 10:20:32'  format 
We must be using some input box or calender script in Webpages to enter a date .
If the Date inserted is not in Format of MySQL it wont get saved to DB.
So when we insert a Date Value from PHP into a database column we need to format according to MySQL.
For this we can use MySQL STR_TO_DATE().
Syntax: STR_TO_DATE(Str,format);
Str is the DATE string  and Format is the format of Str.
Please remember this function always return a DATE in 'YY-MM-DD' format.
eg:
SELECT STR_TO_DATE('18-7-2012','%d-%m-%Y')
prints : 2012-07-18
we mention is the second argument the format in which we pass the Str which has a date.
if we pass the Str in '2012/07/18' (ie YY/MM?DD)
SELECT STR_TO_DATE(' 2012/07/18 ','%Y / %d / %m')
prints : 2012-07-18
Blogger templates
Blogger news
Blogroll
Archives
- 
        ▼ 
      
2011
(212)
- 
        ▼ 
      
August
(17)
- create table in php with mysql
 - Upload the image to server
 - For getting the files and folders in a directory
 - How fast can you type?
 - user model<!--?phpsession_start();define("DB_SERVE...
 - Register Globals
 - Assignment #8 Final Project
 - global variable in php
 - Display local country time, instent of displaying ...
 - REST Architecture with PHP
 - PHP to MySQL Date Format
 - How to enable showing queries in Code Igniter prof...
 - Vertrigo server installation
 - Enable Windows Authentication in a PHP website
 - Tipo de datos Booleanos en Php
 - What is PHP?
 - Introduction
 
 
 - 
        ▼ 
      
August
(17)