HELP! Auto Update for Information based on day / time?

  • 1
  • Question
  • Updated 8 years ago
  • Answered
How can I have some info auto update based on day and time? I am a fitness instructor and I have a "next class" section, I would like for it to update automatically. Say, if it is Monday before 530pm to read "xyz text" or if it's Friday after 630pm to read "abc text". I have read several html, java, php tutorials and forums -- and I'm at a total loss! It's the last thing I need help with and I am ready to launch my updated site -- any help is MUCH appreciated!
Photo of stacy.perrault

stacy.perrault

  • 3 Posts
  • 0 Reply Likes
  • confused

Posted 8 years ago

  • 1
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hello stacy.perrault

I do not know any script codes off hand that can do this. Perhaps if you know of one, we can help you with this.

Hopefully others will be able to share their ideas on how to do this.
Photo of stacy.perrault

stacy.perrault

  • 3 Posts
  • 0 Reply Likes
What I have found is that it is JAVA Based... It is an If / Else statement. Here is an example that I have been trying to follow:
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hello stacy.perrault

Unfortunately, your code did not show up. Can you please use either this encoder: http://forsite.synthasite.com/encoder...

or use <!-- Code goes in here -->

This will stop the code from rendering on the forum.
Photo of stacy.perrault

stacy.perrault

  • 3 Posts
  • 0 Reply Likes
<!-- <script type="text/javascript">
//Write a "Good morning" greeting if
//the time is less than 10

var d=new Date();
var time=d.getHours();

if (time<10)
{
document.write("<b>Good morning</b>");
}
</script> -->

hope this works!
Photo of Sanja

Sanja, Official Rep

  • 10698 Posts
  • 495 Reply Likes
Hello stacy.perrault

Unfortunately, that code does not seem to do anything for me when I tried to test it on my site. Can you please point me to where you got this code from? What is the site URL?
Photo of papa

papa

  • 327 Posts
  • 20 Reply Likes
Here's an Updater

This one will change on a daily based automatically. I do not believe you can set it for changing at a certain time of day.

http://anchorsite.yolasite.com/dayupd...

Papa
Photo of papa

papa

  • 327 Posts
  • 20 Reply Likes
UPDATE

I found the code you have above fromw3schools and put it all together and created an example of updating down to an hour basics. I could not find a way to get it to change on the half-hour or by set minutes. Sorry This might maybe help

papa