List:General Discussion« Previous MessageNext Message »
From:B. Fongo Date:April 22 2004 4:10pm
Subject:RE: Datetime format in MySQL
View as plain text  
You can specify the date (Datetime or Timestamp) format when creating
table as follows:

Type	=>Format  
-------------------------
DATETIME => YYYY-MM-DD HH:MM:SS
DATE => YYYY-MM-DD 
TIME => HH:MM:SS
YEAR =>YYYY

TIMESTAMP
-------------------
TIMESTAMP(14)  => YYYYMMDDHHMMSS
TIMESTAMP(12)  => YYYYMMDDHHMM
TIMESTAMP(10)  => YYYYMMDDHH
TIMESTAMP(8)  => YYYYMMDD
TIMESTAMP(6)  => YYYYMM
TIMESTAMP(4)  => YYYY
TIMESTAMP(2)  => YY

So you can say something like this:

Create table Use (user char(30), LoginTime DATE); # This will set
LoginTime  as 2004-04-22 
Create table Use (user char(30), LoginTime TIMESTAMP(12)); # This will
set LoginTime  as 200404221810

HTH

Babs

||> -----Original Message-----
||> From: Amit_Wadhwa@stripped [mailto:Amit_Wadhwa@stripped]
||> Sent: Thursday, April 22, 2004 1:56 PM
||> To: mysql@stripped
||> Subject: Datetime format in MySQL
||> 
||> Hi All,
||> 	Can you  specify what format to use for the datetime column eg.
||> in oracle you can say I wanna use DD-MMM-YYYY HH:MM:SS and so
on....?
||> 
||> Regards,
||> Amit
||> 
||> 
||> --
||> MySQL General Mailing List
||> For list archives: http://lists.mysql.com/mysql
||> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1



Thread
Datetime format in MySQLAmit_Wadhwa22 Apr
  • Re: Datetime format in MySQLDuncan Hill22 Apr
  • Re: Datetime format in MySQLEgor Egorov22 Apr
  • RE: Datetime format in MySQLB. Fongo22 Apr
    • What is overhead and what causes it?Eve Atley20 Aug