Date Conversion Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PHP newbie here...

 

I have some PHP code writing the date/time into a MS SQL 2000 database
like this:

 

date('l jS \of F Y h:i:s A')

 

So the text it writes into the DB is like: Thursday 15th of April 2010
10:13:42 AM

 

The database field is defined as varchar, not datetime...so it's a
string essentially...

 

How in the world do I do a date conversion on this? I've tried things
like:

 

select * from table where convert(datetime,fieldname) >= '6/10/2010' 

(where fieldname is the string in question)

 

Which results in "Syntax error converting datetime from character
string."

 

So I guess I have two questions:

 

1)      Can I write a SQL query that will convert this properly into a
datetime?

2)      If not, I guess I'll need to change the code to write the date
differently into the system, how should this statement be changed to
allow for proper conversion? date('l jS \of F Y h:i:s A')

 

Thanks for any help!


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux