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

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

 



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 )
> > > 
> > > I've never dealt with object in PHP.  Something new learnt today.
> > > I'm now able to use get_object_vars($rec[0]) to extract the info
> > > from the object.
> > 
> > You don't need get_object_vars(), you can simply use
> > 
> > $rec[0]->year;
> > 
> 
> Ah, great.  Thanks much for the tip and the pointers.  That's
> even better.
> 
> Another question.  It's not hard to do this mapping.  But if
> given a month
> like '9', is there any PHP function that can convert it to a full
> text month name 'September'? 

Yes.

Oh, you want to know what it is?

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));

I'm sure you'll get other equally valid suggestions!

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.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