Click to See Complete Forum and Search --> : date shown with . instead of /


chrismartz
05-10-2005, 04:21 PM
How can I show the date with . instead of /'s? like 4.27.2005

wmif
05-10-2005, 05:02 PM
replace(date,"/",".")

chrismartz
05-10-2005, 05:05 PM
thanks

Bullschmidt
05-10-2005, 05:44 PM
And here's another method although a lot longer.

To make a variable be in the format of mm.dd.yyyy (and the final line of code can be modifed for other date formats and other lines can be modifed such as if want m.d.yyyy), perhaps try something like the following which you might even make into a function that you might put on a page that gets included in your main pages:

varFld = CDate(MyVariable)

intMonth = Month(varFld)
intDay = Day(varFld)
intYr = Year(varFld)

If intMonth < 10 Then
strMonth = "0" & CStr(intMonth)
Else
strMonth = CStr(intMonth)
End If

If intDay < 10 Then
strDay = "0" & CStr(intDay)
Else
strDay = CStr(intDay)
End If

strYr = Right(CStr(intYr), 4) ' And change the 4 to 2 for 2 year dates.

varFld = CStr(strMonth & "." & strDay & "." & strYr)

chrismartz
05-12-2005, 04:31 PM
I am doing an archives list and am wondering how to select the correct entries in the database with the month name in the url. In the url I have
name=April&year=2005&total=4/2005&month=true
don't worry about the month, I the above url should show only listings of those that were posted in April of the year 2005. Any ideas?

wmif
05-12-2005, 08:36 PM
you would have to interpret the month number from the query string and put that in your query. whats the query look like?

chrismartz
05-14-2005, 07:31 PM
i don't understand what you mean

wmif
05-16-2005, 02:31 PM
how do you identify the month in the database of these archives?

chrismartz
05-16-2005, 04:11 PM
I identify the month with the querystring of name=April&year=2005&total=4/2005&month=true where name is the name of the month to select from, year is the year of the post, and total is the month/year combination

wmif
05-16-2005, 04:22 PM
in the database though, what columns do you use to group the archives. do you have the month name and year number or do you have just a single date, or what?

chrismartz
05-16-2005, 04:27 PM
i just have a single date for each entry, those are in the mm/dd/yyyy format

wmif
05-16-2005, 06:09 PM
in the query string example that you provided you have the month, then the year, then the month and year. you dont need to have all that. get the month and the year either seperate or together.

if you post the month in a string like 'april' then you will need to have a table in your code that will tell it 4 = 'april' etc. or you can provide the month in a numeric format.

so now you can build the query with the info provided.

"select * from archives where month(archdate) = " & request.querystring("month") & " and year(archdate) = " & request.querystring("year")

something like that.

chrismartz
05-17-2005, 05:04 PM
how would i tell the computer that 4 = april and it know what i mean?

wmif
05-17-2005, 06:00 PM
i would pass the number in the query string instead of passing the name of the month. would be a lot easier.