how can i convert string format to datetime:

the string is formatted like : December 01, 2010 (which is another table) tblTransactions
and the datetime column format is : 2010-12-01 (another table) tblBilling

how can i search my string format to my table which matches the column (datetime field).

Thank You.

Recommended Answers

I assume your database is mysql

select str_to_date(string_date_col, '%M %d, %Y') from tblTransaction

Str_to_date function will change string to date type


Jump to Post

All 4 Replies

Member Avatar
SELECT somefield FROM tblTransactions WHERE somedatetimecolumn = STR_TO_DATE('$stringdate','%M %d, %Y');

Assuming you're using PHP - $stringdate and MySQL. You don't give much info, do you?

hi..sorry..i was not able to say..im using SQL Server 2005.
Thank You.

hey i found the solution..

SELECT convert(datetime, @somestringcolumn) from tblTransactions


Be a part of the DaniWeb community

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