We help IT Professionals succeed at work.

Finding last second of the month from Unix Time

Matthew_Way
Matthew_Way asked
on
Medium Priority
349 Views
Last Modified: 2008-02-26

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

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2006
Commented:
$lastsecond = mktime(23,59,59, date('m', $timestamp), date('t', $timestamp), date('Y', $timestamp));

-r-

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Godly, 2 minutes.... I just had to say this cause its so good.

Joe P
CERTIFIED EXPERT
Top Expert 2006

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

-r-
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

Author

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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.