Welcome to MSFN

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0

how to change image according to time (PHP)

2 posts in this topic

I am working on Radio website where i have to show image of program that's on air according to name of day and time. i made something that works but it works for hours not for minutes. i want it to be shown by minutes

like some program is from 04:30AM to 05:00AM. my code only works for hours like 04:00 AM to 05:00AM..

i created a function that gets program name according to name of day.

here's is how my code looks like

function get_program_name($name_of_day){ //
date_default_timezone_set('Asia/Kathmandu'); //Asia/Kathmandu.
switch ($name_of_day) { //switching case starts here

case 'Sunday':
if (05<=$timehour && &timehour <06) { // 05:00AM to 06:00AM

elseif (06<=$timehour && timehour <07) { // 06:00AM to 07:00AM

case 'Monday':


case 'Tuesday':


case 'Wednesday':


case 'Thrusday':


case 'Friday':


case 'Saturday':


echo "Something went wrong!!";
}//case closes here
}//function closes here

thanks in advanced..

Edited by sanjeev18

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.