Simple Question on Dates

Results 1 to 2 of 2

Thread: Simple Question on Dates

  1. #1
    Join Date
    Dec 1969

    Default Simple Question on Dates

    I have a simple question on dates where I have a variable within <BR>VBScript which is a date variable called WEEK_ENDING. The problem<BR>that I am having is that within my program I 3 variable called mo,da, and year where I try to create a date variable which is y2k compliant. <BR><BR>My code look something like the following.<BR>dim mo<BR>dim da<BR>dim yr<BR>dim week_ending<BR>mo = 2<BR>da = 20<BR>yr = 2000<BR><BR>week_ending = DateSerial(mo,da,yr) <BR><BR>The question I have is that my week_ending variable has a format of 2/20/00. This format is not usable within my program because I cannot do any date calculations within it. <BR><BR>Can someone please help.<BR><BR>&#062;&#062;Vipul

  2. #2
    Trung Dang Guest

    Default RE: Simple Question on Dates

    In general, you can use the function CDate to type cast your date compliant variable on the fly...<BR><BR>You can try week_ending = CDate(mo & "/" & da & "/" & yr) to force a date into your variable "week_ending" so can you perform other date related calculations (DateAdd, etc.)

Posting Permissions

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