[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Finding last second of the month from Unix Time

Posted on 2006-03-21
5
Medium Priority
?
320 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

0
Comment
Question by:Matthew_Way
  • 2
  • 2
5 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 1000 total points
ID: 16254411
$lastsecond = mktime(23,59,59, date('m', $timestamp), date('t', $timestamp), date('Y', $timestamp));

-r-
0
 
LVL 17

Expert Comment

by:BogoJoker
ID: 16254428
Godly, 2 minutes.... I just had to say this cause its so good.

Joe P
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 16254445
I had to type with one hand, because eating breakfast at the same time :-P

-r-
0
 
LVL 17

Expert Comment

by:BogoJoker
ID: 16254490
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
 

Author Comment

by:Matthew_Way
ID: 16254988
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month20 days, 2 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question