.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 5th, 2012, 10:35 PM
cecilia_2004 cecilia_2004 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 305 cecilia_2004 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 Days 18 h 57 m 35 sec
Reputation Power: 0
How to display message on Home Page automatically

Hi everyone,

I would like to display "We are open" on the Home Page (asp.net 4.0) when the time is 9am automatically.

And then I would like to display "We are close" on the Home Page (asp.net 4.0) when the time is 5pm automatically.

And then the next 9am, display "We are open" on the Home Page automatically,

And then the next 5pm, display "We are close" on the Home Page automatically, ..., and so on.

Can I make this to work ? If yes, please let me know what are the search keyword(s) so that I can search the internet by myself.

Thanks,

May
Comments on this post
MBirchmeier agrees: Thank you for changing the way you post, to look for ways to learn instead of just asking for the
answer

Reply With Quote
  #2  
Old July 11th, 2012, 12:50 PM
cchy1988 cchy1988 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 18 cchy1988 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 49 m 19 sec
Reputation Power: 0
without using ajax, the contents of your page are refreshed only when there's any roundtrip to server. If you are periodically making ajax calls to server you can do the 'open/close' stuff even if there's no activity form user's side..

1) on page_load check if time is 9AM or 6PM and set the text of a label as 'we are open' or close respectively

2) On clients side.. After every fixed interval (say 5 mins) make ajax calls to server.. server would return the current time, javascript checks and if conditions fall true, it updates the text of the said label to 'we are open/close'


One thing though, wen u say 9 AM, do you mean 9 am your server time or 9AM the time at visitor's place?? you gonna have to take care of that as well if your website is intended for users from other countries as well, (which i feel is not the case here though)

Reply With Quote
  #3  
Old July 12th, 2012, 11:52 AM
Ronster Ronster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Location: Charlotte
Posts: 412 Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 2 h 6 m 13 sec
Reputation Power: 143
Quote:
Originally Posted by cchy1988
One thing though, wen u say 9 AM, do you mean 9 am your server time or 9AM the time at visitor's place?? you gonna have to take care of that as well if your website is intended for users from other countries as well, (which i feel is not the case here though)


Not even in different countries is that an issue.
Here in the U.S., we have 4 different time zones. So if your server is on the East Coast, the time will be different if it is on the west coast.

Reply With Quote
  #4  
Old July 12th, 2012, 12:08 PM
MrFujin's Avatar
MrFujin MrFujin is offline
Lord of the Dance
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Oct 2003
Posts: 3,129 MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level)MrFujin User rank is General 11st Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 2 Weeks 23 h 6 m 34 sec
Reputation Power: 1736
Were just thinking if there was any physical "location" or if it is only web-based.

If there is a physical location, that could be in the east, while the server (time) is in the middle and the visitor is at the west. Which time to use

To answer OP questions, I suggest you take a look at this page
http://msdn.microsoft.com/en-us/library/system.datetime.aspx

The terms at that page are also (more or less) used in other languages, including javascript (AJAX) suggested by cchy1988.

Reply With Quote
  #5  
Old July 12th, 2012, 04:51 PM
cecilia_2004 cecilia_2004 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 305 cecilia_2004 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 Days 18 h 57 m 35 sec
Reputation Power: 0
Quote:
Originally Posted by cchy1988
without using ajax, the contents of your page are refreshed only when there's any roundtrip to server. If you are periodically making ajax calls to server you can do the 'open/close' stuff even if there's no activity form user's side..

1) on page_load check if time is 9AM or 6PM and set the text of a label as 'we are open' or close respectively

2) On clients side.. After every fixed interval (say 5 mins) make ajax calls to server.. server would return the current time, javascript checks and if conditions fall true, it updates the text of the said label to 'we are open/close'


One thing though, wen u say 9 AM, do you mean 9 am your server time or 9AM the time at visitor's place?? you gonna have to take care of that as well if your website is intended for users from other countries as well, (which i feel is not the case here though)


Thanks for everyone's help!

I mean 9am on my server time.

Thanks again!

May

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > How to display message on Home Page automatically

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap