Finding last second of the month from Unix Time


I need to find out the last second of the month that a given Unix time stamp is in.

The time is parsed from a log file with strtotime().

$timestamp = strtotime($str);

How do I work out the last second of the month that $timestamp is in ?

Thanks

Matt

Matthew_WayAsked:
Who is Participating?
 
RoonaanCommented:
$lastsecond = mktime(23,59,59, date('m', $timestamp), date('t', $timestamp), date('Y', $timestamp));

-r-
0
 
BogoJokerCommented:
Godly, 2 minutes.... I just had to say this cause its so good.

Joe P
0
 
RoonaanCommented:
I had to type with one hand, because eating breakfast at the same time :-P

-r-
0
 
BogoJokerCommented:
So great, I put that in my profile.
Congrats on CSS Wizard.  Your going up fast!  Well g'nite.
Roon's answer work for you Matthew_Way?

Joe P
0
 
Matthew_WayAuthor Commented:
Thanks Roonan,

I'm typing with one hand as well, Slipped down a bank in the weekend.

But it's night time, just about to have dinner.

Matt
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.