Separate year from date format

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
dv_evan
Forum Commoner
Posts: 42
Joined: Wed Apr 09, 2008 8:23 am

Separate year from date format

Post by dv_evan »

Dear All,

I have already attempted searching for this issue but came up with nothing.
I am extracting records from MySQL, I have the dates in the date field in the format dd/mm/yr, which was enter from a normal registration form.

I would like to display the 'yr' (year only) from the dd/mm/yr field.

eg: Name/ Address / Year instead of Name/Address/Date
Can you assist in helping me solve this problem please.

Regards
Dave
elpepefontana
Forum Newbie
Posts: 5
Joined: Thu Mar 12, 2009 6:34 am

Re: Separate year from date format

Post by elpepefontana »

list($day,$month,$year) = explode("/",$date);
print $year;
dv_evan
Forum Commoner
Posts: 42
Joined: Wed Apr 09, 2008 8:23 am

Re: Separate year from date format

Post by dv_evan »

Thanks elpepefontana for your response.

Best Regards
Dave
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Separate year from date format

Post by pickle »

Please don't double post. Locking topic.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Locked