Solved

# convert date to words in vb 6.0

Posted on 2006-05-12
246 Views
i want to convert date to words in VB
Ex:
13/05/2006
Thirteen May Two Thousand Six
Can anyone help me.
0
Question by:vijayrajan_n
1 Comment

LVL 1

Accepted Solution

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

## Join & Write a Comment Already a member? Login.

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

#### 734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

#### Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!