convert date to words in vb 6.0

i want to convert date to words in VB
Ex:
        13/05/2006
  Thirteen May Two Thousand Six
Can anyone help me.
vijayrajan_nAsked:
Who is Participating?
 
rbvoigtConnect With a Mentor Commented:
Does this suit your purpose?


Public Function BeautifyNumber(ByVal n As Integer)
    Dim thousands As Integer
    thousands = Fix(n / 1000)
    Dim hundreds As Integer
    hundreds = Fix(n / 100)
    If thousands > 1 Or hundreds = 10 Then
        n = n Mod 1000
        BeautifyNumber = BeautifyNumber(thousands) & " Thousand" & IIf(n > 0, " " & BeautifyNumber(n), "")
        Exit Function
    End If
    If hundreds > 0 Then
        n = n Mod 100
        BeautifyNumber = BeautifyNumber(hundreds) & " Hundred" & IIf(n > 0, " " & BeautifyNumber(n), "")
        Exit Function
    End If
    Dim tens As Integer
    tens = Fix(n / 10)
    If tens > 1 Then
        n = n Mod 10
        BeautifyNumber = Choose(tens - 1, "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety") & IIf(n > 0, "-" & BeautifyNumber(n), "")
        Exit Function
    End If
    If tens = 1 Then
        BeautifyNumber = Choose(n - 9, "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen")
    Else
        BeautifyNumber = Choose(n + 1, "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine")
    End If
End Function

Function BeautifyDate(ByVal dy As Integer, ByVal mn As Integer, ByVal yr As Integer) As String
    BeautifyDate = BeautifyNumber(dy) & " " & MonthName(mn) & " " & BeautifyNumber(yr)
End Function
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.