Well, In VB, Lets say you have a textbox called Text1 and a command button called Command1. Then, if you put tthis in your command buttons click event, it'll display the date in the textbox when you click on it.
Private Sub Command1_Click()
Text1.Text = Format(Date, "dd/mm/yyyy")
End Sub
If you use e.g.MM/DD/YY format dates in a program, you will get either a runtime-error(e.g.month>12)or the wrong date (e.g.March 12 instead of December 3) when your program isused in Europe. And vice versa, of course. Even Microsoft's own example programs (like the MAPI sample in VB3) make this stupid mistake and fail miserably.Use the format command to make sure you get the date you want. For example
strTodaysDate = Format[$](Now,"Short Date")
As a side note, Microsoft has taken much heat on the newsgroup for VB's bad support for internationalization! Just try to make a date literal in source code that works everywhere as little exercise. Answer elsewhere in this document.)
For more details , Please visit the source site :
http://www.mckisicsoftware.com /Resources/visual_basic_faqs.htm#q_ 7
Answered by
Alok Gupta
at
10:47 AM on September 18, 2008