|
-
Mar 13th, 2002, 07:29 PM
#1
Thread Starter
Fanatic Member
FormatDateTime
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.
-
Mar 13th, 2002, 08:57 PM
#2
Fanatic Member
you can use vbshortdate
Response.Write FormatDateTime(Now, vbShortDate)
Result is 01/20/02.
If a post has helped you then Please Rate it!
-
Mar 13th, 2002, 11:44 PM
#3
Thread Starter
Fanatic Member
But I only want in "dd/mm/yyyy" format. Can someone help?
-
Mar 14th, 2002, 12:59 AM
#4
PowerPoster
hi
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%>
-
Mar 14th, 2002, 05:50 AM
#5
Addicted Member
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
To use: DateFormat(yourDate)
Last edited by sweevo; Mar 14th, 2002 at 05:53 AM.
-
Mar 14th, 2002, 04:23 PM
#6
Thread Starter
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|