PC Review


Reply
Thread Tools Rate Thread

Convert Date into words

 
 
Abdul Shakeel
Guest
Posts: n/a
 
      26th Jun 2009

Hi,

I want to Convert Any date in to Word like
19/06/2009 ---- Nineteenth of June Tow Thousand Nine
help me urgently

--
Regards,

 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      26th Jun 2009

You might get something from this site.

http://support.microsoft.com/kb/213360








"Abdul Shakeel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I want to Convert Any date in to Word like
> 19/06/2009 ---- Nineteenth of June Tow Thousand Nine
> help me urgently
>
> --
> Regards,
>



 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      26th Jun 2009

Here is a function (modified to include the word "of" that you requested)
that I originally wrote and posted for the compiled version of VB but which
works fine in VBA as well...

Function DateToWords(ByVal DateIn As Variant) As String
Dim Yrs As String
Dim Hundreds As String
Dim Decades As String
Dim Tens As Variant
Dim Ordinal As Variant
Dim Cardinal As Variant
Ordinal = Array("First", "Second", "Third", _
"Fourth", "Fifth", "Sixth", _
"Seventh", "Eighth", "Nineth", _
"Tenth", "Eleventh", "Twelfth", _
"Thirteenth", "Fourteenth", _
"Fifteenth", "Sixteenth", _
"Seventeenth", "Eighteenth", _
"Nineteenth", "Twentieth", _
"Twenty-first", "Twenty-second", _
"Twenty-third", "Twenty-fourth", _
"Twenty-fifth", "Twenty-sixth", _
"Twenty-seventh", "Twenty-eighth", _
"Twenty-nineth", "Thirtieth", _
"Thirty-first")
Cardinal = Array("", "One", "Two", "Three", "Four", _
"Five", "Six", "Seven", "Eight", "Nine", _
"Ten", "Eleven", "Twelve", "Thirteen", _
"Fourteen", "Fifteen", "Sixteen", _
"Seventeen", "Eighteen", "Nineteen")
Tens = Array("Twenty", "Thirty", "Forty", "Fifty", _
"Sixty", "Seventy", "Eighty", "Ninety")
DateIn = CDate(DateIn)
Yrs = CStr(Year(DateIn))
Decades = Mid$(Yrs, 3)
If CInt(Decades) < 20 Then
Decades = Cardinal(CInt(Decades))
Else
Decades = Tens(CInt(Left$(Decades, 1)) - 2) & "-" & _
Cardinal(CInt(Right$(Decades, 1)))
End If
Hundreds = Mid$(Yrs, 2, 1)
If CInt(Hundreds) Then
Hundreds = Cardinal(CInt(Hundreds)) & " Hundred "
Else
Hundreds = ""
End If
DateToWords = Ordinal(Day(DateIn) - 1) & _
Format$(DateIn, " of mmmm ") & _
Cardinal(CInt(Left$(Yrs, 1))) & _
" Thousand " & Hundreds & Decades
End Function

--
Rick (MVP - Excel)


"Abdul Shakeel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I want to Convert Any date in to Word like
> 19/06/2009 ---- Nineteenth of June Tow Thousand Nine
> help me urgently
>
> --
> Regards,
>


 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      27th Jun 2009

WOW!!!

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Rick Rothstein" wrote:

> Here is a function (modified to include the word "of" that you requested)
> that I originally wrote and posted for the compiled version of VB but which
> works fine in VBA as well...
>
> Function DateToWords(ByVal DateIn As Variant) As String
> Dim Yrs As String
> Dim Hundreds As String
> Dim Decades As String
> Dim Tens As Variant
> Dim Ordinal As Variant
> Dim Cardinal As Variant
> Ordinal = Array("First", "Second", "Third", _
> "Fourth", "Fifth", "Sixth", _
> "Seventh", "Eighth", "Nineth", _
> "Tenth", "Eleventh", "Twelfth", _
> "Thirteenth", "Fourteenth", _
> "Fifteenth", "Sixteenth", _
> "Seventeenth", "Eighteenth", _
> "Nineteenth", "Twentieth", _
> "Twenty-first", "Twenty-second", _
> "Twenty-third", "Twenty-fourth", _
> "Twenty-fifth", "Twenty-sixth", _
> "Twenty-seventh", "Twenty-eighth", _
> "Twenty-nineth", "Thirtieth", _
> "Thirty-first")
> Cardinal = Array("", "One", "Two", "Three", "Four", _
> "Five", "Six", "Seven", "Eight", "Nine", _
> "Ten", "Eleven", "Twelve", "Thirteen", _
> "Fourteen", "Fifteen", "Sixteen", _
> "Seventeen", "Eighteen", "Nineteen")
> Tens = Array("Twenty", "Thirty", "Forty", "Fifty", _
> "Sixty", "Seventy", "Eighty", "Ninety")
> DateIn = CDate(DateIn)
> Yrs = CStr(Year(DateIn))
> Decades = Mid$(Yrs, 3)
> If CInt(Decades) < 20 Then
> Decades = Cardinal(CInt(Decades))
> Else
> Decades = Tens(CInt(Left$(Decades, 1)) - 2) & "-" & _
> Cardinal(CInt(Right$(Decades, 1)))
> End If
> Hundreds = Mid$(Yrs, 2, 1)
> If CInt(Hundreds) Then
> Hundreds = Cardinal(CInt(Hundreds)) & " Hundred "
> Else
> Hundreds = ""
> End If
> DateToWords = Ordinal(Day(DateIn) - 1) & _
> Format$(DateIn, " of mmmm ") & _
> Cardinal(CInt(Left$(Yrs, 1))) & _
> " Thousand " & Hundreds & Decades
> End Function
>
> --
> Rick (MVP - Excel)
>
>
> "Abdul Shakeel" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > I want to Convert Any date in to Word like
> > 19/06/2009 ---- Nineteenth of June Tow Thousand Nine
> > help me urgently
> >
> > --
> > Regards,
> >

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
My words turned into boxes and stuff, how do I get the words back gypsy Microsoft Word Document Management 1 15th Feb 2009 10:01 PM
how to convert numeric to words Example 525 in words (Twenty five Ganta Amar Nath Microsoft Excel Misc 2 17th Jul 2008 10:21 AM
Format date to convert into words weird0 Microsoft C# .NET 8 26th Feb 2008 07:01 AM
i have two date fileds Opend date Due date, can i set default on due date so, its always = to open date on my data entry form1 Urgent Mike Saifie Microsoft Access Form Coding 1 9th Mar 2006 02:08 AM
how do i insert words into a column without erasing the words =?Utf-8?B?c29jY2VyNTU4NQ==?= Microsoft Excel Misc 0 8th Jun 2005 11:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:05 AM.