It's 5 o'clock somewhere (script)

GuinnessMan

Junior Member
Joined
Apr 4, 2009
Messages
120
Reaction score
90
I am putting together a sort of hobby site (built on WordPress) for a colleague of mine and wanted to draw attention to his heavy advocacy for the legalization of marijuana. He asked me if there was a way one could create a script that would update regularly to show where it is 4:20. For example, at 4:20 PST the web script would output text saying, it's 4:20 in Los Angeles.

Any assistance on this would be great!
 
there's a beer site out there somehwere that does exactly that - and I remember it from years ago, so it should be pretty easy.

But sorry, thats all the help I can give
 
Thank you! At least it's confirmed. I'm doing my best...so far just getting lyrics and etymology.
 
You could do an email blast daily at 4:20 (time zone specific) that offers special deals on pot-related products & services, or does updates on the State of Marijuanadom, such as pending legislation. Also, "joke" emails where businesses (local grocery stores) claim to have specials "Albertson's 4:20 special: 3-liter bottle of Mountain Dew + 32 oz. bag of Doritos for $4.20, today only"

Sports corner that only features highlights of players that have the number "4", or the number "20" on their jersey. Obviously, April 20th is a big day.

Start developing a list of music that has direct reference to pot, for use in your in-house advertising.
 
Last edited:
I have no experience with marijuana and I don't know if I read this post right, but this script should do what I thought was asked for. It displays a random place where the local time is the nearest to the given time. Hope this makes sense, I'm a little bit tired. :)
It makes use of php's date/time functions.
PHP:
<?php
$time = '1:00pm'; //format hh:mm - either 24h or 12h - pm/am gets converted to 24h-format
$origin_timezone = 'PST';

//dummy to get one of origin_timezone's identifiers
$tz = new DateTimeZone('Europe/London');
$arr = $tz->listAbbreviations(); //we'll use this again later

//get origin_timezone's offset
$tz = new DateTimeZone($arr[strtolower($origin_timezone)][0]['timezone_id']);
$offset = $tz->getOffset(new DateTime());

//get time in seconds
$seconds = explode(':',$time);
$seconds = ($seconds[0]+(strpos($time,'pm') ? 12 : 0))*3600+(int)$seconds[1]*60;  

//get origin_timezone's current time
$tz_seconds = new DateTime(null,$tz);
$tz_seconds = $tz_seconds->format('H:i');
$tz_seconds = explode(':',$tz_seconds);
$tz_seconds = $tz_seconds[0]*3600+(int)$tz_seconds[1]*60;

//get difference and mathematically nearest target tz offset
$diff = $tz_seconds-$seconds-3600;
$target_tz = $offset-($diff%3600>1800 ? $diff+$diff%3600 : $diff-$diff%3600);

//get identifier for nearest target tz
//$a contains timezone's abbreviation, $b contains array with timezone_ids
$ids=array();
foreach($arr as $a  => $b){
    //echo $b[0]['offset'];echo '<br>';
    foreach($b as $c)
    if ($c['offset'] == $target_tz && strlen($c['timezone_id'])>4){
        //store each random timezone_id
        $ids[]=$c['timezone_id'];
    }
}

//display random timezone_id
echo 'It soon will be (or was not long ago or is currently) '.$time.' in '.$ids[array_rand($ids)];
?>
I'm not sure if it could've been done in an easier way, it's my first draft. At least it should give some ideas. :)
 
"Albertson's 4:20 special: 3-liter bottle of Mountain Dew + 32 oz. bag of Doritos for $4.20, today only"

Hell yes great idea.



In regards to the It's 5 o'clock somewhere cliche...That's for drinking right?

...I always used noon...Or, you know, after breakfast...
 
You could do an email blast daily at 4:20 (time zone specific) that offers special deals on pot-related products & services, or does updates on the statue of Marijuanadom, such as pending legislation. Also, "joke" emails where businesses (local grocery stores) claim to have specials "Albertson's 4:20 special: 3-liter bottle of Mountain Dew + 32 oz. bag of Doritos for $4.20, today only"

Sports corner that only features highlights of players that have the number "4", or the number "20" on their jersey. Obviously, April 20th is a big day.

Start developing a list of music that has direct reference to pot, for use in your in-house advertising.

Quite the mind you have. Great ideas!
 
Here's another one:
Hire someone to write an app for iPhone, and every day it goes off at 4:20 with the sound...

BONG! BONG! BONG!

Okay, so maybe that one was dumb, but this one's not:

You need a mascot, like the Geico Gecko. Maybe a mouse, like Speedy Gonzalez, only REAL S~L~O~W. He talks slow, and moves slow and the first thing he does when anyone new shows up is passes the blunt. Then they slow down too, roflmao. He can be a spin-off of "Smokey the Bear" only his name is "Tokie". One day the Geico Gecko shows up with his obnoxious British/Australian accent and starts going on about car insurance, and Tokie passes him the blunt.

Suddenly, the Gecko sounds just like Cheech Marin from "Up in Smoke" or that surfer dude on "Fast Times at Ridgemont High".

Then, Geico (the real company) issues a C & D, which makes nice publicity for the web-site. You can claim "Fair Use" because it's a parody.
 
I have no experience with marijuana and I don't know if I read this post right, but this script should do what I thought was asked for. It displays a random place where the local time is the nearest to the given time. Hope this makes sense, I'm a little bit tired. :)
It makes use of php's date/time functions.
PHP:
<?php
$time = '1:00pm'; //format hh:mm - either 24h or 12h - pm/am gets converted to 24h-format
$origin_timezone = 'PST';

//dummy to get one of origin_timezone's identifiers
$tz = new DateTimeZone('Europe/London');
$arr = $tz->listAbbreviations(); //we'll use this again later

//get origin_timezone's offset
$tz = new DateTimeZone($arr[strtolower($origin_timezone)][0]['timezone_id']);
$offset = $tz->getOffset(new DateTime());

//get time in seconds
$seconds = explode(':',$time);
$seconds = ($seconds[0]+(strpos($time,'pm') ? 12 : 0))*3600+(int)$seconds[1]*60;  

//get origin_timezone's current time
$tz_seconds = new DateTime(null,$tz);
$tz_seconds = $tz_seconds->format('H:i');
$tz_seconds = explode(':',$tz_seconds);
$tz_seconds = $tz_seconds[0]*3600+(int)$tz_seconds[1]*60;

//get difference and mathematically nearest target tz offset
$diff = $tz_seconds-$seconds-3600;
$target_tz = $offset-($diff%3600>1800 ? $diff+$diff%3600 : $diff-$diff%3600);

//get identifier for nearest target tz
//$a contains timezone's abbreviation, $b contains array with timezone_ids
$ids=array();
foreach($arr as $a  => $b){
    //echo $b[0]['offset'];echo '<br>';
    foreach($b as $c)
    if ($c['offset'] == $target_tz && strlen($c['timezone_id'])>4){
        //store each random timezone_id
        $ids[]=$c['timezone_id'];
    }
}

//display random timezone_id
echo 'It soon will be (or was not long ago or is currently) '.$time.' in '.$ids[array_rand($ids)];
?>
I'm not sure if it could've been done in an easier way, it's my first draft. At least it should give some ideas. :)

Wow...you are a beautiful man! Thanks and Rep given.
 
I don't know people drink beer at 5 of clock. I drink when I damn well feel like it. My liver can't tell time.:drinking2
 
Back
Top