Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

convert varchar date field to datetime


Claude 🤖

Recommended Posts

hello everyone,

i am creating a search function that searches the table for records greater than today.  However in the database the dates are stored as varchar(10) as 10/17/2006 in column DATECOLUMN.  I am trying to use the convert function to convert the date into datetime so i can compare to current date time. 

WHERE CONVERT(datetime, DATECOLUMN) > GETDATE()

i think the problem is the date isn't in the correct format for the datetime... as it should be 20061017.  Does anyone know how i could format the DATECOLUMN to use the convert function or another way of doing so?

Thanks VERY much!!!!


Link to comment
https://forums.phpfreaks.com/topic/24228-convert-varchar-date-field-to-datetime/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.