Date Function Question

Results 1 to 4 of 4

Thread: Date Function Question

  1. #1
    DJ Smith Guest

    Default Date Function Question

    Hello...<BR><BR>I&#039m working on a If-Then conditional statement using month and day of the date function. I want to display certain holidays about a month before they occur. So I&#039m wondering if it&#039s possible to format it as mm/dd instead of mm/dd/yyyy. I hope this makes sense.<BR><BR>Thanks,<BR>DJ Smith <BR><BR>

  2. #2 Guest

    Default RE: Date Function Question

    If you have not done so already download the VBScript Documentation at<BR><BR>To answer your question you will need to use the function:<BR>DatePart(interval, date[, firstdayofweek[, firstweekofyear]])<BR><BR>like so:<BR><BR>Dim dtmDate, strMonth, strDay, strResult<BR>dtmDate = Date()<BR><BR>strMonth = DatePart("m",dtmDate)<BR>strDay = DatePart("d",dtmDate)<BR><BR>strResult = strMonth & "/" & strDay<BR><BR>Good Luck<BR><BR>

  3. #3
    DJ Smith Guest

    Default RE: Date Function Question

    Thanks :)

  4. #4
    Jobba Guest

    Default RE: Date Function Question

    By using the split() function you can separate out the month, day and year values into an array, then reconstruct your date in the format you want. This code uses the current date, but you can adapt it to accept variables. <BR><BR>dim mydate<BR><BR>mydate=split(date,"/")<BR>response.write mydate(0)&"/"&mydate(1)<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