> I have a db field, type varchar, that is actually a 'date' 
 > string formatted as dd-mm-YYYY. I used type 'varchar' (rather than 
 > type 'date') since I had to accomplish other things with it.

 > Now, however, I do need to extract the Year (the last four 
 > digits in the array).

Ummm, are you sure it's an array?  How are you extracting the date
string from your database?  Normally you'd end up with a string when you
extract a varchar field from a database.

 > I've tried to access the array $_SESSION['expiry'] but I don't know 
 > how to explode this array to extract all characters

I take it you are setting this session variable from the date
information in the database?

Is the code that sets the session variable changing the format of the
database information at all?  If not then you should still have your
date in the form 'dd-mm-yyyy' shouldn't you?

 > Is there a way of extracting all characters in that array?

I'm not sure you have an array to deal with unless you're talking about
the result of exploding your text string.

If you've exploded your string and are now trying to deal with the array
then, given what you've said, $array_name[2] would probably contain the
year.

Alternately, if you've got the string to work with you might find it
just as effective to do this:

$year = substr($full_date_string, -4);

This will grab the last four characters from the string which, in your
case, would be the year.

CYA, Dave


--
----------------------------------------------------------------------
Outback Queensland Internet                   ************************
Longreach                                     ** New Web Site Online *
Queensland                                    ************************
Australia                                     W: www.outbackqld.net.au


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

Reply via email to