Click here to Skip to main content
Click here to Skip to main content

Indian Number & Date Format

, 29 Aug 2012
Rate this:
Please Sign up or sign in to vote.
A control for Indian number format, converts number to words, Hindi words, comma style and Indian date processor

Introduction

Indian.dll control is a control for applications which need the data to be formated in Indian formats/national language (Hindi). It's very useful if you are working with windows (which still does not support Indian formats). This will format the data (numbers) in Indian comma style (eg. 9,999/-), Indian words in English as well as Hindi(eg. 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 in to 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 equivelent to 02-01-2003 (dd-MM-yyyy)

To create a new translation in the XML file.

//
// Section Encapsulates the language information
//

 < Section Name="Marathi" > ... < / section >

// Fill in the all the values for the "Key Name"
//
// For example: 

< Key Name="Rupees" Value="रुपये" / >

// Save the file in UTF-8 encoding. Supports multiple languages and hence no 
// limit on the number of sections that can be created.

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

Points of Interest

I was baffled when I used to get different results of my invoice program from the same data. This was, since 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 learnt it to be very useful for many programers and hence I decided to write this article.

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

You may and 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 graph 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 langauge & 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.

Version 2.5.0: Support for translation file. Now support for any language can be added by user by editing the translation file.

Version 3.0.0: Few enhancements and fixes. "Marathi" language is moved out to translation file.

Contents of Download

  • The solution built in VC# Express 2010
  • The usable files in your program:
    • Indian.dll
    • Settings.dll
    • langFor.xml

Planned Update

  • No Plans to update this program further until I get a really new idea haunts my mind.

License

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

Share

About the Author

hprahul
Web Developer
India India
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.

Comments and Discussions

 
Questionconvert number to marathi words PinmemberNIl Code26-Mar-13 0:26 
AnswerRe: convert number to marathi words Pinmemberhprahul26-Mar-13 1:04 
GeneralRe: convert number to marathi words PinmemberNIl Code26-Mar-13 1:10 
GeneralRe: convert number to marathi words PinmemberNIl Code26-Mar-13 19:21 
GeneralRe: convert number to marathi words Pinmemberhprahul27-Mar-13 15:04 
GeneralRe: convert number to marathi words PinmemberNielcode28-Mar-13 21:19 
GeneralRe: convert number to marathi words Pinmemberhprahul29-Mar-13 14:57 
GeneralRe: convert number to marathi words PinmemberNielcode29-Mar-13 20:44 
hey thanks rahul
i read ur mail n did reply
 
well have u used Japser report / ireport for making reports
if yes then plz check my question related to same
 
n its link is :
http://www.codeproject.com/Questions/568210/accessplustextfiedplustoplusanotherplustextfieldpl?loginkey=false
 
and do reply
regards
Nil
QuestionGood lib for indian business applications PinmemberSakarSR1-Sep-12 17:18 
AnswerRe: Good lib for indian business applications Pinmemberhprahul1-Sep-12 23:38 
GeneralMy vote of 1 PinmvpDave Kreskowiak30-Aug-12 1:35 
GeneralRe: My vote of 1 Pinmemberhprahul30-Aug-12 5:17 
GeneralNot an article. PinmemberSharjith30-Aug-12 1:29 
GeneralRe: Not an article. Pinmemberhprahul30-Aug-12 5:16 
QuestionThx buddy, nice code Pinmemberdanny33330-Aug-12 0:28 
AnswerRe: Thx buddy, nice code Pinmemberhprahul30-Aug-12 5:16 
QuestionThanks Pinmemberalbarhami30-Aug-12 0:23 
AnswerRe: Thanks Pinmemberhprahul30-Aug-12 5:14 
GeneralMy vote of 5 PinmemberChristian Amado29-Aug-12 10:54 
GeneralRe: My vote of 5 Pinmemberhprahul29-Aug-12 14:57 
GeneralReally?? PinmvpDave Kreskowiak30-Aug-12 1:33 
GeneralRe: Really?? PinmemberChristian Amado30-Aug-12 2:04 
GeneralRe: Really?? Pinmemberhprahul30-Aug-12 5:13 
GeneralRe: Really?? Pinmemberhprahul30-Aug-12 5:13 
Questionnice dll Pinmembernaweez12-Jul-12 21:51 

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.

| Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 30 Aug 2012
Article Copyright 2007 by hprahul
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid