Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 19th, 2006, 12:06 PM
Registered User
Join Date: Jun 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Date functions

I am sure I have got this totally wrong, but it was'nt a bad try for an absolute beginner.
What I want to do is, dependant on the date, either write or omit some text. This is based on the school calendar for the school that I work for. The code I have written is below and is probably totally wrong:
    Dim DatTerm
    DatTerm = #21/12/2006#
        If DatTerm < Now() Then
        Response.Write "<span style='font-size:18px; font-weight:bold'>AUTUMN TERM&nbsp;&nbsp;Monday 4<sup>th</sup> September - Wednesday 20<sup>th</sup> December 2006</span><br><strong>Half Term : Monday 23<sup>rd</sup> October - Friday 27<sup>th</sup> October 2006</strong>"
        Response.Write ""
        End If

How wrong is this? Should I just give up and go back to HTML?

Thanks for any help

Old December 19th, 2006, 04:49 PM
Friend of Wrox
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41

Some comments

>wrap you date in double quotes not hashes
>Suggest you use a .css file and place classes in your code - global styles, very useful!!!
>SUP tag - Since this tag is new, support for it is not universal. Make sure that the text would still look readable if the SUP tag weren't used.
>STRONG - Im not sure this should be used, I would use a <b> instead
>Is there any need for the else condition?
>forgive me if you are however I would be using tables.

You say 'how wrong is it' - there are many ways to skin a cat. Look at your code using different browsers and versions, if it looks the same, great. If not then the code needs to be looked at

Wind is your friend
Old December 20th, 2006, 02:39 AM
Registered User
Join Date: Jun 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks mat41
It suddenly clicked why the code wasn't working - I had the date format wrong - I was using dd/mm/yyyy instead of mm/dd/yyyy.

Thanks again

Similar Threads
Thread Thread Starter Forum Replies Last Post
date functions in xslt1.0 pradeepn XSLT 4 July 26th, 2007 04:28 AM
SQL date functions frankb522 Other Programming Languages 2 June 24th, 2006 09:04 AM
DATE FUNCTIONS DARSIN General .NET 1 January 14th, 2005 09:11 AM
Date functions and statements Thomas82 Classic ASP Professional 3 June 29th, 2004 10:09 AM
Convert String Date to Date for a SQL Query tdaustin Classic ASP Basics 4 July 7th, 2003 06:01 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.