Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP 5 MS SQL 2000 Dates

Status
Not open for further replies.

Borvik

Programmer
Jan 2, 2002
1,392
US
Ok - I'm getting frazzled over here and I'm starting to not think clearly.

I've got an issue with a PHP website of mine not properly displaying dates (all showing up as 12/31/1969).

Before I moved the site to a new server it was working fine (PHP 4 something on that server).

Now on PHP 5 it isn't working. I took out the date formatting code so I could see the raw data being returned by the database query and here is a sample of what is being returned (format code first $nd holds the raw field data):

Code:
date("m/d/Y", strtotime($nd))

11/sep/2006 10:51
7/aoû/2006 18:41
31/jui/2006 13:47
17/mai/2006 13:58
17/mai/2006 13:55

It's obvious to me why the formatting code doesn't work - it's not the proper date input to be able to format it.

Any ideas on how to fix this?
 
I don't understand. Is this output what you get when you run the raw data through date(strtotime())? Or is that code there just to give us an idea what the nonfunctional code is working?



Want the best answers? Ask the best questions! TANSTAAFL!
 
Never mind (new that was going to happen).

Apparently in php.ini mssql.datetimeconvert defaults to on. Setting that to off solved the problem.
 
Thanks for the quick response sleipnir214 - that was to give an idea of the nonfunctional (supposedly) code.

As you can see I've solved the problem - gotta love migrating to new servers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top