Wednesday, May 9, 2012

Format Date Display throughout application

After a thorough searching and testing came to a way that helps in changing the display format of date or time to my wished format , in this case it is “dd/MM/yyyy” and the code is simple too.  It is as follows:

Dim c As System.Globalization.CultureInfo
c = System.Globalization.CultureInfo.CreateSpecificCulture(System.Globalization.CultureInfo.CurrentCulture.Name)
c.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy"
Thread.CurrentThread.CurrentCulture = c

and not to forget to import System.Threading.

No comments:

Post a Comment