| | |
How to insert date in string format into MYSQL table as DATE data type
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2009
Posts: 19
Reputation:
Solved Threads: 0
Hello people,
Well The problem that I am facing is:
I have a date in string format like 30 Jun 2009, how can I insert it into MYSQL table as DATE data type?
I created the table and declare data type for Date column as DATE, when I insert 30 Jun 2009 as a value into the table, it becomes 00:00:00. What should I do to avoid this error. Please suggest. Thanks
Ajay
Well The problem that I am facing is:
I have a date in string format like 30 Jun 2009, how can I insert it into MYSQL table as DATE data type?
I created the table and declare data type for Date column as DATE, when I insert 30 Jun 2009 as a value into the table, it becomes 00:00:00. What should I do to avoid this error. Please suggest. Thanks
Ajay
2
#2 Oct 19th, 2009
depending on the language used as the front end to the mysql back end,
php $date=strtotime('string');
asp $date=DateTime.Parse('string');
in sql getdate($date)
don't use those codes look em up, I havent, so there will be errors
sql date format sux, is explained here http://www.tizag.com/sqlTutorial/sqldate.php
hugely sux
personal view
other people with less rigid literal minds have little trouble with setting up the processing to run queries on sql date types
php $date=strtotime('string');
asp $date=DateTime.Parse('string');
in sql getdate($date)
don't use those codes look em up, I havent, so there will be errors
sql date format sux, is explained here http://www.tizag.com/sqlTutorial/sqldate.php
hugely sux
personal view
a unix timestamp is easierapologies
other people with less rigid literal minds have little trouble with setting up the processing to run queries on sql date types
Last edited by almostbob; Oct 19th, 2009 at 3:10 pm.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Apr 2009
Posts: 51
Reputation:
Solved Threads: 11
-1
#3 Oct 20th, 2009
try to convert it as a date in the insert statement by using this function:
str_to_date('30 Jun 2009','%d %b %Y')
str_to_date('30 Jun 2009','%d %b %Y')
![]() |
Similar Threads
- hyperlink data type? (MySQL)
- [URGENT]Convert String("2009") to Date(Year) (VB.NET)
- Help with creating MySQL Table (PHP)
- how to convert date to mysql format (VB.NET)
- storing date mysql (PHP)
- selecting from a table and listing various data from another one related to the first (ASP.NET)
- updating multiple columns in single MySQL table (PHP)
- how to add 2 dates that are in string format to get the next date (ASP.NET)
- how to add 2 dates that are in string format (ASP)
Other Threads in the MySQL Forum
- Previous Thread: Connection Issues with SSH
- Next Thread: including SP in dts package
| Thread Tools | Search this Thread |
Tag cloud for MySQL
"use" 1 agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright court crm data database design developer development distinct dui eliminate enter enterprise error eudora facebook form foss gartner gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron microsoft microsoftexchange mindtouch multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opengovernment opensource operand oracle penelope php priceupdating query referencedesign reorderingcolumns saas search select sharepoint simpledb spotify statement sugarcrm syntax techsupport thunderbird transparency update virtualization






