Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2005
    Location
    SW England
    Posts
    102

    Unanswered: change dd/mm/yyyy to text for menu

    I need to do two things with date data.
    The dates are inputted into QSL Server in this format. dd/mm/yyyy
    I have a dynamic 'trip date' menu which comes out like this:
    14/01/2006
    29/01/2006
    12/02/2006
    18/02/2006
    19/02/2006
    24/02/2006
    but I would rather it says: '14 January 2006' etc. any ideas?

    I then want to bring up a page of all the trips in a certain month.
    currently my page is hard-coded for March like this:

    "SELECT * FROM dest_search WHERE start_date LIKE 'mar%2006%' ORDER BY start_date"

    presumably I need a request.string but I think the slashes would mess up the url that sent it.
    I'm sure there's an elegant solution to this (presumably) common problem but I can't find it.
    Thanks

  2. #2
    Join Date
    Oct 2005
    Location
    SW England
    Posts
    102
    update to my previous post.
    Just noticed the post below mine about Oracle and doing the same thing! doh!
    anyway I modified that code to extract the month like so:
    myStartDate = m4RS("start_date")
    mstartDate = MonthName(Month(myStartDate))

  3. #3
    Join Date
    Oct 2005
    Posts
    178
    Quote Originally Posted by darkmunk
    I need to do two things with date data.
    The dates are inputted into QSL Server in this format. dd/mm/yyyy
    I have a dynamic 'trip date' menu which comes out like this:
    14/01/2006
    29/01/2006
    12/02/2006
    18/02/2006
    19/02/2006
    24/02/2006
    but I would rather it says: '14 January 2006' etc. any ideas?

    I then want to bring up a page of all the trips in a certain month.
    currently my page is hard-coded for March like this:

    "SELECT * FROM dest_search WHERE start_date LIKE 'mar%2006%' ORDER BY start_date"

    presumably I need a request.string but I think the slashes would mess up the url that sent it.
    I'm sure there's an elegant solution to this (presumably) common problem but I can't find it.
    Thanks
    use..
    <%= formatdatetime(Date,vblongdate) %>

    or
    <%= formatdatetime(Now,vblongdate) %> will show
    Wednesday, December 07, 2005

    Note: You might need to parse and arrange your records date format.
    THe're also more arguments aside from vblongdate
    they are...
    vbGeneralDate
    vbShortDate

  4. #4
    Join Date
    Oct 2005
    Location
    SW England
    Posts
    102
    nice one! vblongdate works a treat. Thanks.
    Any ideas how I pass this 'month' data to the SQL in the next page so it displays all the trips in a particular month?

  5. #5
    Join Date
    Oct 2005
    Posts
    178

    Wink

    You can also use Month(date) which will give you a number of the month. So you can use this month number in your sql and when you display the resulting recordset use the FormatDateTime(Date, vbLongDate).
    Other functions you can use are..
    DateValue(date)
    Day(date)
    Year(date)

  6. #6
    Join Date
    Oct 2005
    Location
    SW England
    Posts
    102
    of course! easy when you know how.
    I was in danger of writing some very long winded code to pass the month component.
    I can go back to colouring-in now.
    cheers
    M

  7. #7
    Join Date
    Oct 2005
    Location
    SW England
    Posts
    102

    Smile

    OK all sorted, I got this from another forum:

    strSQL="SELECT * FROM dest_search"
    if request("myMonth") <> "" then
    strSQL = strSQL & " WHERE month(start_date) = " & request("myMonth") & " ORDER BY start_date"
    end if
    oRS.Open strSQL, oConn, 2, 3

    Hope this helps some one else
    Last edited by darkmunk; 12-08-05 at 13:02. Reason: problem solved

Posting Permissions

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