Click here to Skip to main content
15,912,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every body,
I want to convert the date time into word format, is der any easy way for doing this.
for eg: 12-01-2010---twelve january two thousand ten
thanking you.
Posted

vpmanu wrote:
der


der is a German word, not an English one, FYI.

Yes, there's easy ways to do this. One obvious one, given the limited data set, is to just write a lookup table for each element to words.
 
Share this answer
 
Check these links (although they are not in C# but you can easily convert them to C#, also they are for currency but ofcourse they can be modified):
1. How to convert a numeric value into English words in Excel[^]
2. Convert Numbers to Words/Text[^]
 
Share this answer
 
hello
for time being u can use this code

Console.WriteLine(DateTime.Now.ToLongDateString());

and the output will be Wednesday, April 21,2010.

now for conversion of numbers into string format my friend u have to write serious code for that which looks some what like this...

As the Given Tag in ur question is C# the below code is too in C#.....

C#
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        void fun()
        {
            Console.WriteLine("Enter numeric value");
            int x = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i <= x; i++)
            {
                switch (i)
                {
                    case 1:
                        Console.WriteLine("One");
                        break;
                    case 2:
                        Console.WriteLine("Two");
                        break;
                    case 3:
                        Console.WriteLine("Three");
                        break;
                    case 4:
                        Console.WriteLine("Four");
                        break;
                    case 5:
                        Console.WriteLine("Five");
                        break;

                    default:
                        Console.WriteLine("Zero");
                        break;
                }
            }


        }

        static void Main(string[] args)
        {
            Program obj = new Program();
            obj.fun();
            //Console.WriteLine(DateTime.Now.ToLongDateString());
        }


    }
}

The above code will ask u for a number enter then at that time enter the numeric value "5" and ur done...

Do rate my answer once u find it useful
Thanks & Regards
Radix :rose:
 
Share this answer
 
v2
vpmanu wrote:
I want to convert the date time into word format

Ok... do it! Looks like a direct mapping...


vpmanu wrote:
is der any easy way for doing this

Thats a relative term there.. tell us what all you tried, might be we can tell which on looks good!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900