PHP Access Date problems. (1 Viewer)

Jiraiya-Sama

New member
Local time
Today, 16:26
Joined
Jun 12, 2009
Messages
2
Hello Hi, :)

I have a problem about date format (dd/mm/yyyy or mm/dd/yyyy........) and hope if anyone can give me some ideas.

ok, i have a php running and using odbc to connect to a access database.
i need to do some date comparison in access database.

so, i have a sql doing this to filter all staff entry date that is later than 1.June.2009
select * from staff where (datevalue(staff.entry) > datevalue('1/6/2009'))

However, when i execute this sql in php, it becomes filter staff entry date that is later than 6.Jan.2009

Funny thing is, when i try to run the exact same SQL in access directly, it understands that it is 1.June.2009.

could anyone give me some hints or ideas why it is?

by the way, if it helps, in my window regional setting, the date format is d/M/y.

Thanks a million.
 

namliam

The Mailman - AWF VIP
Local time
Tomorrow, 00:26
Joined
Aug 11, 2003
Messages
11,696
The problem is... When your actually working in Access it uses your Regional settings.
When using ODBC, it works on its OWN....

Access NEEDS MM/DD/YYYY, no questions asked. So use MM/DD/YYYY.
Why use datevalue and not ie. DateSerial ??? That lets you specify the exact date in Day, Month, Year without ever wondering (guarantee) if it goes well...

When in doubt, use DateSerial or MM/DD/YYYY!!!
 

Users who are viewing this thread

Top Bottom