Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
what wud the code be for a condition to display a link between certain times
Old 10-16-2008, 03: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
 
 
Register now for full access!
Old 10-16-2008, 03: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, 03:46 AM Re: what wud the code be for a condition to display a link between certain times
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,516
Name: Chris Hirst
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-16-2008, 03: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, 03: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, 04: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, 06: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, 01:50 PM Re: what wud the code be for a condition to display a link between certain times
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,516
Name: Chris Hirst
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-16-2008, 02:07 PM Re: what wud the code be for a condition to display a link between certain times
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,516
Name: Chris Hirst
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!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-16-2008, 03: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 03:36 PM..
Invictus is offline
Reply With Quote
View Public Profile
 
Old 10-16-2008, 10: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,662
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?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 10-16-2008, 11: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

Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE
Sean@WMS is offline
Reply With Quote
View Public Profile Visit Sean@WMS's homepage!
 
Old 10-17-2008, 04:40 AM Re: what wud the code be for a condition to display a link between certain times
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,516
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Good point, I managed to read it the opposite way around.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-17-2008, 05: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, 11: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.44981 seconds with 12 queries