The company I work for does a weekly webinar every thursday. What I am trying to find is a script that will display the the following:

"The next free online Webinar is:
Thursday, XX, XXXX at 2 PM"

If someone is logged onto my page on a Wednesday February 27, I need to display to him/her that the next demo will be on Thursday February 28. If the same person logs on on Friday February 29, I need to display to him the next demo date which will be on Thursday March 6. All this displaying the current date as well of course.

Can anyone help? I know this is difficult but any help is appreciated.

You cannot really rely on the user's clock, even for the day of the week,
which is why most time calculations end up on the server.
But usually the clock is ok, and a lot of webpages assume so.

It is not finding next thursday- it is figuring out what 2 pm is to your visitor.
You will need to use the GMT (Universal time) hours for your event's time;
in this example I'm using EST (6 hours behind GMT)

This function has default arguments based on your example,
or you can pass it a new time (GMT hours and minutes) or day of the week.

My code is easily adaptable for the server's clock, on inserting server-side variables into. But I don't think is a good idea. User needs to know when it is his next Thursday. If he has not settled the correct time on his computer, that will be his problem, and there is no way to check/correct that from outside.

02-28-2008, 03:46 PM

mrhoo

Oops.

I blundered in my solution...
The point is, if an event is going to be online at a specific time,
that time has to be converted from GMT to local time.

2 pm Thursday for me and my event may be 7pm in London, or 11am in California,
or Wednesday in Australia.

If you give the script a starting date that has been calculated as GMT,
the local machine will immediately convert it to local time for all of its calculations.

Otherwise, I'm afraid our mates in England will miss the show-
not to mention Cleveland.

// test based on EST var start =new Date(Date.UTC(2008,1,28,19,0,0,0))
// This is the GMT for Thursday, Feb 28 2:00 pm-
// you can set it at date, past or future
// EST is 5 hours behind GMT on that date- it varies
// You will need to set start from your own offsetalert(getNextWeekday(start))

The above code works great, but how can you pick every other week. I have tried, but no luck. Thx ahead for any help.

01-15-2014, 05:46 AM

\\.\

Use PHP for this and the web serve clock, this assumes that the web provider has set the proper time, you find as I have allot of american budget hosts don't bother setting the server time or putting in services to syncronise their server clocks. If this is paid for rackspace and your companies server being hosted in a farm, then your server time will be whatever your company IT department set before shipping or if they bought a rack space, whatever the IT department of the farm set if at all...

Server clocks are just as prone to be wrong, however ... established web time services that give GMT times are accurate and set, so referencing them once a week for example is a good idea and knowing how far ahead / behind GMT you are would allow you to set your server to your local time.

PHP does offer time zone based settings, this again takes its timings from the server...

As for JavaScript, it takes its time from the users operating system which generally for the individuals needs will have a clock set to their local time, this however does not help you in offering a service based on your Thursday Webinar