建站代码网

热门标签

日期独立内容

显示内容取决于当前的日期是否为能添加值到任何网站的强大和有效的工具。不管它是提供一个限时要求,还是一个虽然已经过期很长时间但是还能用新内容自动更新的页面。下面的代码重复了三次显示完整日期独立内容效果的过程。内容是用来设置只显示12/31/1999和显示预览和内容展示和视图和截止日期的天数。

<% ' The following for next loop is used to demonstrate ' how this code will work on three different dates ' The variable the date should be set to date() to retrieve ' the current date when implemented 下面的循环是被用来展示这些代码在3个不同的日期怎样工作的 变量日期应该被用来设置日期()来检索执行的当前的日期 for count = 1 to 3 if count = 1 then the_date=#12/30/1999# end if if count = 2 then the_date=#12/31/1999# end if if count = 3 then the_date=#01/01/2000# end if start_date= #12/31/1999# expiration_date = #01/01/2000# %> <%= "Start Date=" & start_date &" End Date=" & expiration_date & " Today=" & the_date %> <br> <% if start_date <= the_date then %> <% if expiration_date - the_date <= 0 then %> Content has expired <u>on</u> <%= expiration_date %> <% else %> Content will appear <u>for</u> <%= expiration_date - the_date %> more day(s) <% end if %> <% else %> Content will appear <u>in</u> <%= abs(the_date - start_date) %> more day(s) <% end if %> <p>&nbsp;</p> <% next %>

X