How can I use the FormatDateTime function (or whatever to get the result I want) to get the date in format dd/mm/yyyy
Thanks.
Printable View
How can I use the FormatDateTime function (or whatever to get the result I want) to get the date in format dd/mm/yyyy
Thanks.
you can use vbshortdate
Response.Write FormatDateTime(Now, vbShortDate)
Result is 01/20/02.
But I only want in "dd/mm/yyyy" format. Can someone help?
I dont think there is any in-built function to give you the date in the manner you want.
use this:
Code:<%
Function GiveMeDate()
dd = day(date)
mm = month(date)
yy = year(date)
GiveMeDate = dd & "/" & mm & "/" & yy
End Function
%>
'Usage:
<%=GiveMeDate%>
To use: DateFormat(yourDate)Code:Private Function DateFormat(inputDate)
Dim arrDate
Dim tempDay
Dim tempMonth
Dim tempYear
'Format the input date as DD MONTHNAME YYYY (long date format)
inputDate = FormatDateTime(inputDate, 1)
'Split up this long date string into the arrDate array
arrDate = Split(inputDate)
'Assign temp vars values from the array
tempDay = arrDate(0) 'Day as First array element
tempYear = arrDate(2) 'Year as Third array element
'Must derive the month number from full month name
Select Case arrDate(1)
Case "January"
tempMonth = "01"
Case "February"
tempMonth = "02"
Case "March"
tempMonth = "03"
Case "April"
tempMonth = "04"
Case "May"
tempMonth = "05"
Case "June"
tempMonth = "06"
Case "July"
tempMonth = "07"
Case "August"
tempMonth = "08"
Case "September"
tempMonth = "09"
Case "October"
tempMonth = "10"
Case "November"
tempMonth = "11"
Case "December"
tempMonth = "12"
End Select
DateFormat = tempDay & "/" & tempMonth & "/" & tempYear
End Function
Thanks all.