Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 15,105 times

Related Categories

How to display a date in a specific language

I do some of my developing on German servers which was always a drag when it came to formatting dates. With .NET you can set the culture info and it is taken care of automatically for you. Nice.

// using System.Globalization // stick this at the top of your class

CultureInfo ci = new CultureInfo("en-US");
DateTime dt = DateTime.Now;
Response.Write(dt.ToString("f",ci));

Response.Write("<br><br>");

DateTime dt2 = DateTime.MinValue;
Response.Write(dt2.ToString("f",ci));

Edward Tanguay updates his personal web site tanguay.info weekly with code, links, quotes and thoughts on web development. Sign up for the free newsletter.

Comments