468,257 Members | 1,429 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

help with date changes

Can some tell me how I could change
1965-11-15 into just 1965.

I need to calculate ages so I will just get
$year = date(Y);
$age = $year - $birthYear;
TIA,
Kelly
Jul 17 '05 #1
3 1242
I noticed that Message-ID: <VkWgc.169529$Pk3.53547@pd7tw1no> from Kelly
contained the following:
Can some tell me how I could change
1965-11-15 into just 1965.

I need to calculate ages so I will just get
$year = date(Y);
$age = $year - $birthYear;


$x=date('Y');
$y=date('Y',strtotime("1965-11-15"));
$age=$x-$y;
print "$age";

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2
Thanks actually I just exploded the other date and took the year from it.
"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:45********************************@4ax.com...
I noticed that Message-ID: <VkWgc.169529$Pk3.53547@pd7tw1no> from Kelly
contained the following:
Can some tell me how I could change
1965-11-15 into just 1965.

I need to calculate ages so I will just get
$year = date(Y);
$age = $year - $birthYear;


$x=date('Y');
$y=date('Y',strtotime("1965-11-15"));
$age=$x-$y;
print "$age";

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

Jul 17 '05 #3
I noticed that Message-ID: <Op2hc.172944$Pk3.70145@pd7tw1no> from Kelly
contained the following:
Thanks actually I just exploded the other date and took the year from it.


strtotime() accepts a wider range of separators

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Shlomi Schwartz | last post: by
3 posts views Thread by NewmanBT | last post: by
9 posts views Thread by Dom Boyce | last post: by
6 posts views Thread by D | last post: by
8 posts views Thread by saladinator | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.