daemonkin
11-15-2007, 12:41 PM
Hi guys,
Trying to parse a date from a known dat to compare with current date:
$next_birthday = '2007-08-08';
mktime(date('g'),date('i'),date('s'),date('m',time($next_birthday)),date('j',time($next_birthday)),d ate('Y',time($next_birthday)));
The if else script is returning the current mktime and not the date's mktime.
Any help appreciated.
D.
rpgfan3233
11-15-2007, 01:51 PM
Ever thought about strtotime (http://www.php.net/strtotime) or are you wanting to convert the date to an integer yourself? Also, you might try date_parse (http://www.php.net/date_parse). It takes a string containing a date and returns an array with the year, month, day, hour, minute, second, fraction of a second, warning count, warnings (a nested array), error count and errors (a nested array) as well as an is_localtime boolean value. On failure to parse properly, the function returns FALSE.
I recommend trying it out.
Inigoesdr
11-15-2007, 06:24 PM
$next_birthday = '2007-08-08';
if(date('Y-m-d') == $next_birthday)
{
// happy birthday
}
else
{
// back to work
}
aedrin
11-15-2007, 06:44 PM
$next_birthday = '2007-08-08';
if(date('Y-m-d') == $next_birthday)
{
// happy birthday
}
else
{
// back to work
}
You don't have to work on your birthday? You are lucky...
Inigoesdr
11-15-2007, 07:29 PM
You don't have to work on your birthday? You are lucky...
I usually take a sick day. :p
daemonkin
11-16-2007, 09:45 AM
Thanks guys I knew I had done it before but could not remember how and then it came to me strotime rather than time
Thanks guys.
PS: I take sickies on my birthday too, usually!
D.
aedrin
11-16-2007, 04:16 PM
I've been missing out! Well, I guess that's what I'll have to do on my birthday. ;)