RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.20% (5.24%*) • Home Loan Fixed: 5.48% (6.24%*) • Fixed: 5.48% (6.24%*) • Variable: 5.20% (5.24%*) • Investment IO: 5.78% (6.81%*) • Investment PI: 5.49% (6.32%*)

Determine The First Monday Timestamp After a Weekend

After a comment from a user on a post we shared detailing new Instagratify features, we wrote up this quick function to see how his suggestion might be applied. When scheduling from Instagram, he didn't want to share posts on a weekend - instead posting on the next Monday at a certain time.

The function below will assess a timestamp to determine if it falls on a Saturday or Sunday and, if it does, determine the timestamp of the following Monday (at a certain time).

1
<?php 
2
/*
3
 Determine The First Monday Timestamp After a Weekend
4
 http://www.beliefmedia.com/code/php-snippets/first-monday-timestamp
5
*/
6
 
7
function beliefmedia_next_monday($timestamp, $time = '10am') {
8
 
9
  $day = date('N', $timestamp);
10
  $timestamp = ($day == 6 || $day == 7) ? strtotime("next monday $time", $timestamp) : $timestamp;
11
 
12
 return $timestamp;
13
}

Usage is as follows:

1
<?php 
2
$timestamp = '1511010605';
3
echo beliefmedia_next_monday($timestamp, $time = '10am');

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  E. Australia Standard Time [ UTC+10, Default ] [ CHECK TO CHANGE ]

  Want to have a chat?
 

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment