Working with a DATE --- help!

Results 1 to 3 of 3

Thread: Working with a DATE --- help!

  1. #1
    Neil Brinson Guest

    Default Working with a DATE --- help!

    I can add or subtract from the system "Date" fine, but when I try to add or subtract from a date that I&#039ve created I get an error - Type Mismatch... see examples below.<BR><BR>This works...<BR>Response.Write Date + 10<BR><BR>Niether of the examples below work...<BR>MyDate = "4/1/2000"<BR>Response.Write MyDate + 10<BR>Response.Write FormatDateTime(MyDate) + 10<BR><BR>If I do a IsDate(MyDate) it returns True ??? What gives? Why doesn&#039t this work?

  2. #2
    Katrina Guest

    Default RE: Working with a DATE --- help!

    Try using parenthesis for the MyDate + 10.<BR><BR>

  3. #3
    RustyKnight Guest

    Default RE: Working with a DATE --- help!

    Niel<BR><BR>When adding a interval to a date you need to use the dateadd() function. When you retrieve the system date it comes in as a number, once it is in your asp script variable it is stored as a variant of the date type.<BR><BR>The format of the dateadd function is:<BR><BR>DateAdd(Interval,Number,Date)<BR>Interv al constants:<BR>Setting Description <BR>yyyy Year <BR>q Quarter <BR>m Month <BR>y Day of year <BR>d Day <BR>w Weekday <BR>ww Week of year <BR>h Hour <BR>n Minute <BR>s Second <BR><BR>Example:<BR>NewDate = DateAdd("m", 1, "31-Jan-95")<BR><BR>Good Luck<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts