07-20-2008, 12:05 AM
Hi,
You can achieve you goal by using the below ways:
1.2. Or else you can use some logic to put the date in your required format, here use datepart function:
I used the below code to verify the "Current Time:"(date part) displayed in the top right corner of this page.
You can achieve you goal by using the below ways:
1.
Code:
User formatdatetime, if your date is in the format of mm/dd/yyyy.
msgbox(formatdatetime(date())) 'displays date in 7/19/2008
msgbox(formatdatetime(date,2)) 'displays date in 7/19/2008
I used the below code to verify the "Current Time:"(date part) displayed in the top right corner of this page.
Code:
dayPart=datepart("d",date())
monthPart=datepart("m",date())
yearPart=datepart("yyyy",date())
If dayPart<10 Then
dayPart="0"&dayPart
End If
If monthPart<10 Then
monthPart="0"&monthPart
End If
reqDate=monthPart&"-"&dayPart&"-"&yearPart
msgbox(reqDate)