Jump to content

Fetching the data from STR_TO_DATE


yoda699

Recommended Posts

I'm sending some information to mysql server to format a string into datetime format that the server can understand. I'm running into problems regarding fetching that data.

$connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
      mysql_select_db(DB_NAME, $connection) or die(mysql_error());
$newSqlDate = "SELECT STR_TO_DATE('$newDateTime', '%m/%d/%Y %h,%i,%p');"; 
  $result = mysql_query($newSqlDate);
$row = mysql_fetch_array($result) or die(mysql_error());
  echo "Date and Time: ".$row['datetime'];
mysql_close($connection);

 

My echo returns only: "array"

 

Thanks

Link to comment
Share on other sites

Guest
This topic is now 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.