Forum Moderators: coopster

Message Too Old, No Replies

PHP 4 MSSQL DateTime

         

vertronics

9:51 pm on Oct 11, 2007 (gmt 0)

10+ Year Member



Hello, I am using PHP 4.x and having a problem where the datetime field in MSSQL has the value of 1/1/1900. Basically, the user did not enter a value.

When I retrieve the datetime in PHP for that record I get 12/31/69.

Iam using:
date("m/d/Y",strtotime(odbc_result($result,"dateSubmitted")));

I know there is a problem with how PHP4.x reads the Unix timestamp, but I have not figured out how to get around the problem.

If the user does not enter the data correctly or leaves the field blank, then, I do not want to return a value for the date field on the display page. Instead, I am getting the value 12/31/69.

Thanks in advance,
CWilson

Gian04

10:37 pm on Oct 11, 2007 (gmt 0)

10+ Year Member



You should check the user inputs, it its blank insert NULL