/    Sign up×
Community /Pin to ProfileBookmark

timestamp query

iam using mssql-server with php.
now i have a field with type of int.. and i sotred a date
in this field in unix timestamp after i conver them using this function:

[code=php]
function date_to_timestamp($time) {

$timeArray = explode(“-“, $time);

if(count($timeArray)) {
$y = $timeArray[0];
$m = $timeArray[1];
$d = $timeArray[2];
return mktime(0,0, 0, $m,$d,$y);
}
return false;
}
[/code]

now, how can make a query that will only list all records with a prticular month…
lets say i want to pass 1 for Jan, 2 for Feb and 3 for March, etc…
pass this int to my query get all records with this month
any idea
Thanks
M

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@Suhas_DhokeApr 10.2007 — Hello Themoon.

You want to display the month name, if you passed the month number. Right ?

if YES then use the date() for the same.

[B][COLOR="DarkRed"]echo date('M', mktime(0,0, 0, $m,$d,$y));[/COLOR][/B]

Hope, Its useful for u.

Enjoy.
×

Success!

Help @themoon 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.20,
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,
)...