If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > change dd/mm/yyyy to text for menu

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-07-05, 11:29
darkmunk darkmunk is offline
Registered User
 
Join Date: Oct 2005
Location: SW England
Posts: 102
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
Reply With Quote
  #2 (permalink)  
Old 12-07-05, 12:21
darkmunk darkmunk is offline
Registered User
 
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))
Reply With Quote
  #3 (permalink)  
Old 12-07-05, 12:31
fredservillon fredservillon is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 12-07-05, 15:06
darkmunk darkmunk is offline
Registered User
 
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?
Reply With Quote
  #5 (permalink)  
Old 12-07-05, 16:25
fredservillon fredservillon is offline
Registered User
 
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)
Reply With Quote
  #6 (permalink)  
Old 12-08-05, 05:02
darkmunk darkmunk is offline
Registered User
 
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
Reply With Quote
  #7 (permalink)  
Old 12-08-05, 10:37
darkmunk darkmunk is offline
Registered User
 
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 12:02. Reason: problem solved
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On