Reply
what wud the code be for a condition to display a link between certain times
Old 10-16-2008, 02:41 AM what wud the code be for a condition to display a link between certain times
Average Talker

Posts: 18
Name: joseph
Trades: 0
Hi, ant solutions to this would be great. I have a link which i need to display between 6am and 24:00. its an asp site. Thanks alot for any help
ajm22386 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 10-16-2008, 02:43 AM Re: what wud the code be for a condition to display a link between certain times
Average Talker

Posts: 18
Name: joseph
Trades: 0
this seems like the wrong lpace to put it. but i was wondrin if i cud do this in html.
ajm22386 is offline
Reply With Quote
View Public Profile
 
Old 10-16-2008, 02:46 AM Re: what wud the code be for a condition to display a link between certain times
chrishirst's Avatar
Super Moderator

Posts: 26,496
Location: Blackpool. UK
Trades: 0
No it can't.

and 6am
Your time zone?

server time zone?

or

visitor time zone?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | Crowded Nightclub? | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-16-2008, 02:48 AM Re: what wud the code be for a condition to display a link between certain times
Average Talker

Posts: 18
Name: joseph
Trades: 0
current date comes from dtmCurrentDate = FormatDateTime(rst("currentdate"),2)
ajm22386 is offline
Reply With Quote
View Public Profile
 
Old 10-16-2008, 02:48 AM Re: what wud the code be for a condition to display a link between certain times
Average Talker

Posts: 18
Name: joseph
Trades: 0
need to come from server time
ajm22386 is offline
Reply With Quote
View Public Profile
 
Old 10-16-2008, 03:34 AM Re: what wud the code be for a condition to display a link between certain times
Experienced Talker

Posts: 46
Name: John Henson
Trades: 0
I think you could probably do this in Javascript, using the local time on the users PC

Like:
Quote:
var d = new Date();
var curr_hour = d.getHours();
var curr_min = d.getMinutes();
document.write(curr_hour + " : " + curr_min);
would output eg. 19:33

If you wanted to do it using server time I think a server side script like PHP is your best bet, and it's really easy. You'd need something like

Quote:

$today
= date("H:i:s"); // 17:16:17
Hope this helps
Invictus is offline
Reply With Quote
View Public Profile
 
Old 10-16-2008, 05:32 AM Re: could any1 help me with small problem
Belfast_des's Avatar
Novice Talker

Posts: 5
Name: Des Smith
Trades: 0
Hi,

There is a time function, http://www.w3schools.com/vbscript/func_time.asp
And if statements, http://www.w3schools.com/vbscript/vb...nditionals.asp

So you should be able to combine these to control when the link is displayed.
Belfast_des is offline
Reply With Quote
View Public Profile
 
Old 10-16-2008, 12:50 PM Re: what wud the code be for a condition to display a link between certain times
chrishirst's Avatar
Super Moderator

Posts: 26,496
Location: Blackpool. UK
Trades: 0
Given this bit from the first post;
Quote:
Originally Posted by ajm22386 View Post
its an asp site.
Quote:
Originally Posted by Invictus View Post
If you wanted to do it using server time I think a server side script like PHP is your best bet,
Hope this helps
It probably wont
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | Crowded Nightclub? | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-16-2008, 01:07 PM Re: what wud the code be for a condition to display a link between certain times
chrishirst's Avatar
Super Moderator

Posts: 26,496
Location: Blackpool. UK
Trades: 0
Code:
if hour(now()) < 6 and hour(now()) > 0 then
     ' show whatever
end if
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | Crowded Nightclub? | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-16-2008, 02:35 PM Re: what wud the code be for a condition to display a link between certain times
Experienced Talker

Posts: 46
Name: John Henson
Trades: 0
oops, I didn't see where he said about it being an ASP site, but anyhow, if it's ASP AJAX will still work...

look at this W3 Schools Tutorial

http://www.w3schools.com/Ajax/ajax_server.asp

Last edited by Invictus; 10-16-2008 at 02:36 PM..
Invictus is offline
Reply With Quote
View Public Profile
 
Old 10-16-2008, 09:11 PM Re: what wud the code be for a condition to display a link between certain times
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,674
Name: John Alexander
Trades: 0
Why would anyone resort to AJAX when it's so simple to do server side? What's the gain from crossing layers unnecessarily?
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 10-16-2008, 10:49 PM Re: what wud the code be for a condition to display a link between certain times
Sean@WMS's Avatar
Skilled Talker

Posts: 52
Name: Sean Connors
Location: Eureka, CA USA
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Code:
if hour(now()) < 6 and hour(now()) > 0 then
     ' show whatever
end if
My dyslexia often gets the better of me too, LOL.

Given:
Quote:
I have a link which i need to display between 6am and 24:00. its an asp site.
This should be:
Code:
if hour(now()) > 6
     ' show whatever
end if
Or
Code:
If Hour(Now())>6 Then Response.Write "<a>My Link</a>"
__________________
Web Merchant Services
Online Payment Processing, FREE shopping cart
Sean@WMS is offline
Reply With Quote
View Public Profile Visit Sean@WMS's homepage!
 
Old 10-17-2008, 03:40 AM Re: what wud the code be for a condition to display a link between certain times
chrishirst's Avatar
Super Moderator

Posts: 26,496
Location: Blackpool. UK
Trades: 0
Good point, I managed to read it the opposite way around.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | Crowded Nightclub? | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-17-2008, 04:09 AM Re: what wud the code be for a condition to display a link between certain times
Experienced Talker

Posts: 46
Name: John Henson
Trades: 0
Quote:
Originally Posted by Learning Newbie View Post
Why would anyone resort to AJAX when it's so simple to do server side? What's the gain from crossing layers unnecessarily?
because the OP seemed to want to use JS rather than using server side stuff and AJAX allows you to use the minimum ASP script (admittedly it does require a fair bit of extra JS though).

If he's happy using ASP instead I agree it could be done very easily.
Invictus is offline
Reply With Quote
View Public Profile
 
Old 10-17-2008, 10:27 AM Re: what wud the code be for a condition to display a link between certain times
Average Talker

Posts: 18
Name: joseph
Trades: 0
Gentle men thanks alot you guys always save my ***. cheers chris your solution wrked
ajm22386 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to what wud the code be for a condition to display a link between certain times
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14648 seconds with 13 queries