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

2006-04-20 Thread John Wells
I don't know if MS Access will behave the same, but in MySQL you can have a query like so: SELECT *, DATE_FORMAT(end_date, '%d %m %Y') as end_date_formatted FROM projects; And it will retrieve all columns from your projects table, plus the extra one you've created on the fly, and it will be

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

2006-04-20 Thread Richard Lynch
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

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

2006-04-20 Thread Bing Du
I don't know if MS Access will behave the same, but in MySQL you can have a query like so: SELECT *, DATE_FORMAT(end_date, '%d %m %Y') as end_date_formatted FROM projects; And it will retrieve all columns from your projects table, plus the extra one you've created on the fly, and it will

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

2006-04-19 Thread Bing Du
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],

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

2006-04-15 Thread chris smith
On 4/14/06, Bing Du [EMAIL PROTECTED] wrote: While all the data-munging in PHP is very interesting... Might I suggest that you just use MySQL's date_format() function to ask MySQL to give you the data you want in the first place? Some purists would claim that the database is not the

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

2006-04-14 Thread Bing Du
While all the data-munging in PHP is very interesting... Might I suggest that you just use MySQL's date_format() function to ask MySQL to give you the data you want in the first place? Some purists would claim that the database is not the place to put presentation logic, of course. And

[PHP] how should MS Access DATETIME be handled in PHP?

2006-04-13 Thread Bing Du
Hello, We have a website which pulls data from its MS Access backend database and publishes the data using Cold Fusion. The Cold Fusion code has '#DateFormat(end_date, Mmmm d, )#'. 'end_date' is a table column of type DATETIME in the Access DB. Now, we need to use PHP instead of Cold

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

2006-04-13 Thread Jochem Maas
Bing Du wrote: Hello, We have a website which pulls data from its MS Access backend database and publishes the data using Cold Fusion. The Cold Fusion code has '#DateFormat(end_date, Mmmm d, )#'. 'end_date' is a table column of type DATETIME in the Access DB. Now, we need to use PHP

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

2006-04-13 Thread Bing Du
apparently $rec[0] is a php object - try the following lines to find out what's inside: echo 'pre'; print_r($rec[0]); echo 'pre'; that will probably give you a clue as to how to extract some useful info from the object. Excellent! Yes, it now does give me a clue to see what's actually

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

2006-04-13 Thread Jochem Maas
Bing Du wrote: apparently $rec[0] is a php object - try the following lines to find out what's inside: echo 'pre'; print_r($rec[0]); echo 'pre'; that will probably give you a clue as to how to extract some useful info from the object. Excellent! Yes, it now does give me a clue to see

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

2006-04-13 Thread Andreas Korthaus
Hi! Bing Du wrote: Excellent! Yes, it now does give me a clue to see what's actually in the object. print_r($rec[0]) shows: stdClass Object ( [year] = 2005 [month] = 8 [day] = 31 [hour] = 0 [minute] = 0 [second] = 0 [fraction] = 0 ) I've never dealt with object in PHP. Something new learnt

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

2006-04-13 Thread Bing Du
I hate list. each to his own :-) try this (untested): list($year,$month,$day,$hour,$minute,$second,$fraction) = array_values(get_object_vars($rec[0])); Magic! That works. In this case, I'd like to use list because I can use the vars directly (e.g. $year) rather than $arr['year']. I need

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

2006-04-13 Thread Bing Du
Hi! Bing Du wrote: Excellent! Yes, it now does give me a clue to see what's actually in the object. print_r($rec[0]) shows: stdClass Object ( [year] = 2005 [month] = 8 [day] = 31 [hour] = 0 [minute] = 0 [second] = 0 [fraction] = 0 ) I've never dealt with object in PHP. Something new

RE: [PHP] how should MS Access DATETIME be handled in PHP?

2006-04-13 Thread Ford, Mike
On 13 April 2006 17:08, Bing Du wrote: Hi! Bing Du wrote: Excellent! Yes, it now does give me a clue to see what's actually in the object. print_r($rec[0]) shows: stdClass Object ( [year] = 2005 [month] = 8 [day] = 31 [hour] = 0 [minute] = 0 [second] = 0 [fraction] = 0 )

RE: [PHP] how should MS Access DATETIME be handled in PHP?

2006-04-13 Thread Bing Du
I expect there's actually several ways, although I'm thinking it's likely that none of them is blindingly obvious. Personally, I think I'd be inclined to do it like this: $mth = 9; echo date('F', mktime(12,0,0, $mth)); Interesting. Thanks a bunch for the tip, Mike. Appreciate it.

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

2006-04-13 Thread Richard Lynch
On Thu, April 13, 2006 9:30 am, Bing Du wrote: $qry = odbtp_query(SELECT end_date,title,projectID FROM projects ORDER BY end_date DESC); While all the data-munging in PHP is very interesting... Might I suggest that you just use MySQL's date_format() function to ask MySQL to give you the data