time release ASP code

R

Rusted

How can I made time released ASP code? I want to make section of code
viewable after a certain date. Something to this effect, but this does not
work right:


if now() >= "6/24/2005" then
Response.Write ( "here is my new html" )
else
Response.Write ( "for now just show the current information" )
end if
 
C

Chris Hohmann

Rusted said:
How can I made time released ASP code? I want to make section of code
viewable after a certain date. Something to this effect, but this does
not work right:


if now() >= "6/24/2005" then
Response.Write ( "here is my new html" )
else
Response.Write ( "for now just show the current information" )
end if

Date literals should be delimited with #. Here's a reference:
http://msdn.microsoft.com/library/en-us/script56/html/vtoriVBScriptFundamentals.asp

Please consider using ISO standard date formats YYYYMMDD or YYYY-MM-DD.
Here's a related article:
http://aspfaq.com/show.asp?id=2260

Response.Write does not return a value, so there is no need for the
parentheses when making the call.
 
R

Roland Hall

: How can I made time released ASP code? I want to make section of code
: viewable after a certain date. Something to this effect, but this does
not
: work right:
:
:
: if now() >= "6/24/2005" then
: Response.Write ( "here is my new html" )
: else
: Response.Write ( "for now just show the current information" )
: end if

Since this is running server-side I don't see a need to make it an ISO
standard.

This will do what you want:

<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True

sub lprt(str)
Response.Write str & "<br />" & vbCrLf
end sub

dim n, t
t = "6/24/2005" ' target date
n = FormatDateTime(now,vbShortDate) ' now - current date

if n >= t then
lprt "Current date " & n & " is greater than or equal to: " & t
else
lprt "Current date " & n & " is prior to " & t
end if
%>

http://kiddanger.com/lab/timerelease.asp

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
E

Evertjan.

Roland Hall wrote on 06 mei 2005 in
microsoft.public.inetserver.asp.general:
Since this is running server-side I don't see a need to make it an ISO
standard.

What you do on your own site is for your taste.

What you advise here should be as general as possible.

The below code switched at 00:00 Central European,
while the server is in Toronto, Canada and on that time:


<%
d = #2005-04-20 18:00# ' 21/4/05 00:00 CET
if now>d then
%>
Switched,<br>you're too late!
<% else %>
Not yet,<br>friend!
<% end if %>
 
R

Roland Hall

: Roland Hall wrote on 06 mei 2005 in
: microsoft.public.inetserver.asp.general:
: > Since this is running server-side I don't see a need to make it an ISO
: > standard.
:
: What you do on your own site is for your taste.
:
: What you advise here should be as general as possible.

How can that date be interpreted any other than mm/dd/yyyy? It's on the
server, and if the server is in the US, it works for everyone worldwide.
Client-side, I would agree with you. Server-side, I do not.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
R

Roland Hall

:
: Date literals should be delimited with #. Here's a reference:
:
http://msdn.microsoft.com/library/en-us/script56/html/vtoriVBScriptFundamentals.asp

I couldn't find a date literal listed except under isDate.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
E

Evertjan.

Roland Hall wrote on 06 mei 2005 in
microsoft.public.inetserver.asp.general:
: Roland Hall wrote on 06 mei 2005 in
: > Since this is running server-side I don't see a need to make it an ISO
: > standard.
:
: What you do on your own site is for your taste.
:
: What you advise here should be as general as possible.

How can that date be interpreted any other than mm/dd/yyyy? It's on the
server, and if the server is in the US, it works for everyone worldwide.
Client-side, I would agree with you. Server-side, I do not.

Why do you suppose everyone's server is in the USA?

The localisation configuration of even a server in the US can be set to the
owners tastes and requirements.

If you answer on usenet your answer are not only to the OP but your advice
goes to many others.
 
R

Roland Hall

: Roland Hall wrote on 06 mei 2005 in
: microsoft.public.inetserver.asp.general:
:
: >: Roland Hall wrote on 06 mei 2005 in
: >: > Since this is running server-side I don't see a need to make it an
ISO
: >: > standard.
: >:
: >: What you do on your own site is for your taste.
: >:
: >: What you advise here should be as general as possible.
: >
: > How can that date be interpreted any other than mm/dd/yyyy? It's on the
: > server, and if the server is in the US, it works for everyone worldwide.
: > Client-side, I would agree with you. Server-side, I do not.
: >
:
: Why do you suppose everyone's server is in the USA?

I don't. Do you suppose everyone's server is outside the USA?

: The localisation configuration of even a server in the US can be set to
the
: owners tastes and requirements.

True but they may not have a lot of hosting if it's set to anything foreign.

: If you answer on usenet your answer are not only to the OP but your advice
: goes to many others.

Perhaps but it was only directed at one. However, for the sake of argument,
I'll concede.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
R

Roland Hall

in message
: : > : > :
: > : Date literals should be delimited with #. Here's a reference:
: > :
: >
http://msdn.microsoft.com/library/en-us/script56/html/vtoriVBScriptFundamentals.asp
: >
: > I couldn't find a date literal listed except under isDate.
:
: Whoops. Here's the right link:
: http://msdn.microsoft.com/library/en-us/script56/html/vbsconstants.asp

Thanks Chris. I thought I was going crazier and it's not time yet.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,158
Messages
2,570,882
Members
47,414
Latest member
djangoframe

Latest Threads

Top