Click here to Skip to main content
Licence CDDL
First Posted 9 Jan 2007
Views 46,259
Downloads 604
Bookmarked 28 times

Indian Number & Date Format

By | 21 Jan 2012 | Article
A control for Indian number format, converts number to words, Hindi words, comma style and Indian date processor

Image showing what control does

Image showing what control does

Introduction

Indian.dll control is a control for applications which needs the data to be formatted in Indian formats/national language (Hindi). It's very useful if you are working with Windows (which still does not support Indian formats, don't know why?). This will format the data (numbers) in Indian comma style (eg. 9,999/-), Indian words in English as well as Hindi (e.g., one lac only) and formats the date independent of system settings to dd-MM-yyyy (not for display, but storage and calculations). Furthermore, it displays the numbers with the new currency symbol for the rupee.

This program is also useful if you have data in Indian format, to be converted into integer.

Using the Code

To use this control, reference the control and start formatting the data, to suit your needs.

To convert data in Indian format to integer

//
// There is a function defined called getVal in the namespace Indian.IndianCurrency
//
int i=Indian.IndianCurrency.getVal("Rs. 99,999/-");

// This will return 99999 to the integer

To convert date from system format to Indian format

//
// There is a function defined called date in the namespace Indian.IndianDate
//
int i=Indian.IndianDate.date("1-2-3");

// This will return 01-02-2003 (dd-MM-yyyy)
// To get the data in other format, 
// you can specify the "Input Format" to get desired result
// For example:
int i=Indian.IndianDate.date("1/2/3", "MM/dd/yyyy");

// This will return 01/02/2003 equivalent to 02-01-2003 (dd-MM-yyyy)

Download the sample program to play with it, you will see some more examples there to reach all results as shown in the images above.

Points of Interest

I was baffled when I used to get different results of my invoice program of the same data. This was due to the fact that all the storage was made in system format. Since then, I learnt that one must follow a rule to save date (at least) in a particular format itself. After using it in several programs, I found it to be very useful for many programmers and hence I decided to write this article.

On this page, apart from the images, I have not used the rupee symbol due to font unavailability on all systems, but the program would work across all systems.

You may or you may not use the font provided to display the rupee symbol. Since this is a Unicode character, you will be able to see it on all fonts with the available galph for the symbol.

This program is free to use and without source. You may wish to drop me a line of where it is being used.

Limitations

  • No source for you to edit.

History

  • Version 1.6.0: First public posting
  • Version 1.7.5: Few enhancements and fixes, decimal included
  • Version 1.8.0: Few enhancements and fixes
  • Version 2.0.0: Few enhancements and fixes. Included Marathi ("mr") as a language & added support for new rupee symbol. Thanks to Shri Javed Patel for Marathi translation.
  • Version 2.1.0: Many fixes and a few enhancements. A nearly new written code

Planned Update

  • Reading translations from an XML file

License

This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)

About the Author

hprahul

Web Developer

India India

Member

I am a computer engineer doing business at my city. I love to program is also engaged in part time programing. Normaly, work for fun and most of the time free of charge.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 3 PinmemberLakamraju Raghuram6:01 21 Jan '12  
GeneralRe: My vote of 3 Pinmemberhprahul3:27 22 Jan '12  
QuestionHow to write in MARATHI PinmemberJavedsamrt2:25 4 Jan '12  
AnswerRe: How to write in MARATHI Pinmemberhprahul5:05 4 Jan '12  
GeneralRe: How to write in MARATHI PinmemberJavedsamrt23:14 11 Jan '12  
GeneralRe: How to write in MARATHI Pinmemberhprahul16:12 15 Jan '12  
GeneralRe: How to write in MARATHI PinmemberJavedsamrt23:25 18 Jan '12  
GeneralRe: How to write in MARATHI Pinmemberhprahul3:25 20 Jan '12  
QuestionDate in Excel Pinmemberrobin1.11:24 20 Aug '11  
GeneralHi Pinmemberkotpritesh23:59 5 Nov '08  
GeneralRe: Hi Pinmemberhprahul16:42 29 Nov '09  
QuestionHi PinmemberNitin Sawant6:11 18 Jun '08  
AnswerRe: Hi Pinmemberhprahul16:47 18 Jun '08  
GeneralGuide me Pinmemberprabhakaran.sr22:12 8 Nov '07  
GeneralRe: Guide me Pinmemberhprahul16:49 18 Jun '08  
Generalsource code PinmemberShashidharreddy23:03 9 Apr '07  
GeneralRe: source code Pinmemberhprahul4:57 10 Apr '07  
QuestionWhat do you mean by Windows does not support it? PinmemberMihai Nita12:20 5 Mar '07  
AnswerRe: What do you mean by Windows does not support it? Pinmemberhprahul14:14 5 Mar '07  
GeneralRe: What do you mean by Windows does not support it? PinmemberMihai Nita19:41 5 Mar '07  
GeneralRe: What do you mean by Windows does not support it? Pinmemberhprahul2:57 6 Mar '07  
GeneralRe: What do you mean by Windows does not support it? PinmemberMihai Nita7:04 6 Mar '07  
GeneralExcellent !!! Pinmemberht71:50 5 Mar '07  
GeneralRe: Excellent !!! Pinmemberhprahul14:18 5 Mar '07  
GeneralRe: Excellent !!! Pinmemberht718:41 5 Mar '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 21 Jan 2012
Article Copyright 2007 by hprahul
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid