How to Format a date to dd-mm-yy. FormatDate Function: Takes a NotesDateTime variable and converts and returns the date to the format. ie.e dd mmm yyyy
How to Format a date to dd-mm-yy. FormatDate Function: Takes a NotesDateTime variable and converts and returns the date to the format. ie.e dd mmm yyyy
| Answer | Function FormatDate (dtOriginal As String) As String
%REM
FormatDate Function
Takes a NotesDateTime variable and converts and returnsthe date to the format
dd mmm yyyy
%END REM
Dim intDay As String
Dim intMonthNo As String
Dim strMonthName
Dim intYear As String
'Get the day
intDay = Day(dtOriginal)
'Get the month and work out the appropriate 3 letter text version
intMonthNo = Month(dtOriginal)
Select Case intMonthNo
Case 1 : strMonthName = "Jan"
Case 2 : strMonthName = "Feb"
Case 3: strMonthName = "Mar"
Case 4: strMonthName = "Apr"
Case 5 : strMonthName = "May"
Case 6 : strMonthName = "Jun"
Case 7 : strMonthName = "Jul"
Case 8 : strMonthName = "Aug"
Case 9 : strMonthName = "Sep"
Case 10 : strMonthName = "Oct"
Case 11 : strMonthName = "Nov"
Case 12 : strMonthName = "Dec"
End Select
'Get the year
intYear = Year(dtOriginal)
'Finally put the all together
FormatDate = Cstr(intDay) & " " & strMonthName & " " & Cstr(intYear)
End Function |
| Attachments | -none- |
| Applies to versions | 4.x; 5.x; 6.x |
| FAQ Provided By | Steven Charles Robinson |
| Credit | |
 |  |
|
|