Format datetime...

D

Doug Swanson

I'm trying to get a datetime value (10/24/2001 6:00 AM) to display as
10/24/01 6:00. I know I could hard code some format but I'm trying to use
the culture info etc. so that (and this is my understanding of it) if in the
web.config I change the culture info to some country that disaplays as
dd/mm/yy hh:mm then my app will display this in that manner.
I can't seem to find any examples using the culture info...on a side note if
I have a varable (mydate as DateTime) and it has a valid datetime value and
I use one of it's functions...aka mydate.getshortdate() or
mydate.getlongdate() will this return the value according to what my culture
info is set to.

thanks
Doug

--
Doug Swanson
Senior Applications Developer
Synchrono, Inc
651.228.1772
(e-mail address removed)
 
S

Steve C. Orr [MVP, MCSD]

I had to display all my dates in Australian format.
The solution turned out to be really easy.
I just added a culture attribute to the end of my globalization tag in my
web.config:

<globalization requestEncoding="utf-8" responseEncoding="utf-8"
culture="en-AU"/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top