/    Sign up×
Community /Pin to ProfileBookmark

Extracting Year field from a date field

Hi,
i am having a table with a Date type as one field
now i am having a query in which some dates are getting selected from that table
now what i want is to extract the year field from all those dates
how can i do that?
do u hav e some ideas

here is some snippet that i am giving to u
==========================================================

$query = “select release_date from ball_details group by release_date “;

$numresults=mysql_query($query);

while ($row= mysql_fetch_array($numresults))
{
$t = $row[“release_date”];
/// // i dont KNOW WHAT TO DO FROM HERE ///////
//$t1 = $t(“Y”);
//$temp_array_for_release_date[$h] = $t;
//$h++;

}

==========================================================
-ashish

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogApr 10.2006 — [code=php]
while($row = mysql_fetch_array($numresults))
{
$year = date("Y", $row['release_date']);
// etc....
}
[/code]
×

Success!

Help @ashishrathore spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...