php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29171 Do not fetch TimeStamp variable
Submitted: 2004-07-15 01:35 UTC Modified: 2004-07-29 05:36 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: alain at samoun dot com Assigned:
Status: Not a bug Package: COM related
PHP Version: 5.0.0 OS: windows XP Pro
Private report: No CVE-ID: None
 [2004-07-15 01:35 UTC] alain at samoun dot com
Description:
------------
Problem getting TimeStamp data from Access database
XP Pro - PHP 5.0.0 ADODB 2.7 Seems to be a casting problem:
Instead of getting for example: 7/7/2004 4:58:10 PM (A Date/Time data type in Access) we get no data in PHP 5.
PHP4.3 gets it correctly.

Reproduce code:
---------------
<?PHP
$table= "FORM_ID_274274176"; 
#Initialize the Database
include("adodb.inc.php");
include("adodb-exceptions.inc.php"); #Catch exeptions in PHP5
include("tohtml.inc.php");
	$db = &ADONewConnection("ado_access");

	#Access database
	$access = 'C:\Program files\forms3\forms32k.mdb';

	$myDSN='PROVIDER=Microsoft.Jet.OLEDB.4.0;'
		. 'DATA SOURCE=' . $access . ';';
		//. 'USER ID=;PASSWORD=;';
		@$db->pConnect($myDSN, "", "", "");	 
	#Query Access	
	$query = "SELECT TimeStamp,A,B FROM $table where A ='TOYOTA'";
	$result = $db->Execute($query) or die("Error in query: $query. " . $db->ErrorMsg());
	echo rs2html($result);

?>	

Expected result:
----------------
TimeStamp	        A	B
7/7/2004 4:58:10 PM  	TOYOTA 	NISSAN
7/7/2004 4:59:00 PM  	TOYOTA 	 
2

Actual result:
--------------
TimeStamp	        A	B
Thu 01, Jan 1970  	TOYOTA 	NISSAN
Thu 01, Jan 1970  	TOYOTA 	 

Note the actual value for the TimeStamp variable is 0, I suppose the "Thu 01, Jan 1970" is a default?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-26 17:22 UTC] msisolak at yahoo dot com
This appears to be an issue with how ADOdb interacts with the new Variant object in PHP5 (not using variant_date_to_timestamp when pulling in a date value).  See follow-up in ADOdb forum:

http://phplens.com/lens/lensforum/msgs.php?id=10253
 [2004-07-29 05:36 UTC] wez@php.net
This is intended behaviour.
It's better for you this way :-)
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jan 28 21:03:45 2023 UTC