-
Q1
Does anyone know how to create something similar to a datepicker on an HTML form?
Is there anything like:
<input TYPE="Datepicker" NAME="FromDate" VALUE="01 May 2000">
Q2
Are there date functions you can use in an asp page.
For example, I want to format a date [format(date, "dd mm yyyy")] or add a date. When I tried to use these functions I received errors. Can anyone offer a solution?
-
I'm not sure about the datepicker but you can format dates using the formatdatetime() function, it takes the regional settings from the server though.
-
You can embed the actual date time picker control easily. You just have to create a license pack file and embed it on the page as well. The only thing is the page will only be able to be displayed with IE4+
There are also many javascript versions out there that are browser independent.
-
I've used formatdatetime() function...
but, too bad... the format options is still to limited to choose...
I can't format my date into :
22 Sept 2000
or
22 September 2000
or
09/22/2000
or
22/09/2000
what I can do, just to format my date into longdate or shortdate.
Any suggestions ???
Cheers,
Wen Lie
-
Here's a VBScript function I wrote that converts a string converted date in 'MM/DD/YY' format to DD-MMM-YY.
You could easily modify it to do what you want.
Code:
Function ConvertDate(strDateString)
Dim intMonth
on error resume next
intMonth = Month(CDate(strDateString))
Select Case intMonth
Case 1
strDateString = Day(CDate(strDateString)) & "-JAN-" & Right(Year(CDate(strDateString)),2)
Case 2
strDateString = Day(CDate(strDateString)) & "-FEB-" & Right(Year(CDate(strDateString)),2)
Case 3
strDateString = Day(CDate(strDateString)) & "-MAR-" & Right(Year(CDate(strDateString)),2)
Case 4
strDateString = Day(CDate(strDateString)) & "-APR-" & Right(Year(CDate(strDateString)),2)
Case 5
strDateString = Day(CDate(strDateString)) & "-MAY-" & Right(Year(CDate(strDateString)),2)
Case 6
strDateString = Day(CDate(strDateString)) & "-JUN-" & Right(Year(CDate(strDateString)),2)
Case 7
strDateString = Day(CDate(strDateString)) & "-JUL-" & Right(Year(CDate(strDateString)),2)
Case 8
strDateString = Day(CDate(strDateString)) & "-AUG-" & Right(Year(CDate(strDateString)),2)
Case 9
strDateString = Day(CDate(strDateString)) & "-SEP-" & Right(Year(CDate(strDateString)),2)
Case 10
strDateString = Day(CDate(strDateString)) & "-OCT-" & Right(Year(CDate(strDateString)),2)
Case 11
strDateString = Day(CDate(strDateString)) & "-NOV-" & Right(Year(CDate(strDateString)),2)
Case Else
strDateString = Day(CDate(strDateString)) & "-DEC-" & Right(Year(CDate(strDateString)),2)
End Select
ConvertDate = strDateString
End Function
-
ok monte...
I've tried your code...
It works... but, nd easily to change.... right... I can change / modify your code to what I need easily...
But, I've got one question for you....
At your code, you only supply 2 digits of year.
My question is...
How about if I want to make my year into 4 digit..
How can I cek whether it is year 19xx or 20xx ???
Thx in reply...
Cheers,
Wen Lie
-
Code:
'Change this:
strDateString = Day(CDate(strDateString)) & "-FEB-" & Right(Year(CDate(strDateString)),2)
'To this:
strDateString = Day(CDate(strDateString)) & "-FEB-" & Year(CDate(strDateString))
'for each case...
Now, that is assuming that your server's regional settings date format has a 4 digit year otherwise it will still return only a 2 digit year.