Jump to content

PHP 5.3.6 Question


adam84

Recommended Posts

Howdy,

 

I have a question about Dates in PHP 5.3.6.

I queried my database (SQL Server 2008) and I got back two columns, a date(StartDate) and a time(StartTime). The software we used only allows the user to enter a StartDate, so that field always has a value, but there are instances where the StartTime is null (no time set). What I want to do is if there is a StartTime, concat it to the StartDate. If there is not StartTime, I want to add a default time. But when I do that, I get an error saying that I cannot combine a string and a date. I really do not understand why this is happening. I set up PHP 5.3.6 on a server, so I am not sure if there something in the php.ini file that is not allowing me or if this is something new. Some help please! Thanks

 

if( $row['StartTime'] != null )
$sTime = $row['StartDate'] . " " . $row['StartTime']; //What I want '2011-05-03 17:58:12.000'
else
$sTime = $row['STartDate'] . " 00:00:00.000"; //What I want '2011-05-03 00:00:000'

Link to comment
https://forums.phpfreaks.com/topic/235549-php-536-question/
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.