Re: how should MS Access DATETIME be handled in PHP?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, April 19, 2006 9:38 am, Bing Du wrote:
>> Do the search as Richard suggested.
>>
>> MS Access might have a similar function you can use, but you'll need
>> to do some searching yourself to find the answer.
>>
> Sure.  I always appreciate various opinions.  I've checked with an
> Access
> expert.  It can be done for Access like Format([DateFieldName], "dddd
> mmmm
> yyyy").  But if fields of date type should be formated as needed in
> the
> query, there is one situation in which I'm not clear how that would
> work.
> Say, I need to query all the fields from a table which has quite a
> fields.
>  Some of the fields are of some kind of date type.  Enumerating the
> fields
> is not feasible.
>
> SELECT * from table;
>
> So in this case, how should the date fields be formated in the query?

If you've got too many fields in the table to enumerate them all and
apply Format() to them, then you've got MUCH bigger problems on your
hands than date format... :-^

That said, there MAYBE is some kind of introspection function in
whatever you are using to find out which fields are date type and
which are not.

PHP and MySQL have it as:
http://php.net/mysql_field_type

So you should be able to come up with a script that:
#1. Examines the table and finds all the fields of type: 'date'
#2. Constructs a query that gets all the fields, but for those of type
'date' wraps Format(date, 'YYYY-MM-DD HH:II:SS') around them. (Or
whatever you need to get what you want)
#3. Send your programmatically-constructed query to the database to
get the data you want, the way you want it.
#4. Drive-through Burger King.

You're on your own to actually find the functions that do the
introspection, if they exist for Access.  Ain't nobody got enough
money to make me actually use Access.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux