Reverse the Day and Month position in DateTime structure?

  • Thread starter pedestrian via DotNetMonster.com
  • Start date
P

pedestrian via DotNetMonster.com

I'm programming ADO.NET WinForm app. I retrieve
data from database, save it to DataTable(s) and show
it to user.

My country use the date format : Day/Month/Year.
I intend to show the user the Date field in the
format: dd/mm/yyyy instead of default mm/dd/yyyy.

Is it possible create another DateTime structure
of this particular format? I do not want to use
the String object because sometimes I would like
to compare the Date values.

Thanks for your assistance.

--
Regards,
Pedestrian, Penang.

Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-ado-net/200609/1
 
C

ChrisM

Not sure I understand the problem.
Surely the way the date is stored internally is not a problem?
You can format it up anyway you choose when the time comes to display it to
the user...?

Chris.
 
O

Otis Mukinfus

I know the DateTime can be formatted as String.
however, is it reformat it and store as DateTime / Date ?

No. If you format it for display it doesn't change the actual value of the
DateTime object.

If you are using the DateTimePicker control, you can set the format as you want
it to be and when the user commits their changes it will put the value the user
selected back in the DateTime object.

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
M

Marina Levit [MVP]

Wouldn't you want to display the value according to the regional settings of
that computer? In which case, calling ToShortDate, and the rest of those
methods, will automatically follow the regional settings.

I think it would be strange to force a particular locale, instead of just
going with whatever the settings are already. Not to mention it's more work.
 
P

pedestrian via DotNetMonster.com

Thanks to you again, Otis.

Thanks Marina, I'm using dd/mm format because this is the
way our country represent the date.
 

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