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.

Member Avatar for diafol
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 meeting, networking, learning, and sharing knowledge.