Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9180855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:09:08+00:00 2026-06-17T18:09:08+00:00

(Moved to Code Review, where this belongs). I have an event recurring on the

  • 0

(Moved to Code Review, where this belongs).

I have an event recurring on the first friday of the month (at 7pm), and I need to output the date of the next first friday coming up.

This is the first bit of PHP I’ve written, and I was wondering if there is a better way to implement this? Server is running PHP 5.3

Here’s what I wrote:

$d = strtotime('today');
$t = strtotime('first friday of this month');

if ($d > $t) {
  $ff = strtotime('first friday of next month');
  $ffn = date('M j', $ff);
  echo 'Friday, '.$ffn.' at 7pm';
} elseif ($d == $t) {
  echo 'Tonight at 7pm';
} else {
  $ff = strtotime('first friday of this month');
  $fft = date('M j', $ff);
  echo 'Friday, '.$fft.' at 7pm';
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:09:09+00:00Added an answer on June 17, 2026 at 6:09 pm

    Confirmed working

    $today  = new DateTime();
    $this_months_friday = new DateTime('first friday of this month');
    $next_months_friday = new DateTime('first friday of next month');
    echo ($today < $this_months_friday) ? $this_months_friday->format('M j') : $next_months_friday->format('M j');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have moved this question to code review I've written a recursive descent parser
This was working..and I moved the disposal code to the finally block, and now
I have the following code: void doPlayerMove(void) { bool moved = false; while (!moved)
Recently I have modified my code to While taking input form STDIN, I moved
I have this code to move my uploaded file to a specific directory: if
I have just moved my code over to a new server (running on Apache
Oops this happened again. I did some refactoring today when i moved code from
I have refactored a class and moved some code from the constructor to a
Please, move this question to Code Review -area . It is better suited there
update I have moved the code to jsFiddle http://jsfiddle.net/TnSV6/13/ when edit is called the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.