Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

my country using dd/mm/yyyy and it hard to fig at regional seting of each client computer so i want to allow they key

 

dd/mm/yyyy

 

and when i add to database i want to convert to

 

mm/dd/yyyy

 

how do i do ? did .net had function to get only day, month and year ? i will rearrage it before add to database

 

 

or another way suggest ?

  • *Experts*
Posted

If you have the value in a DateTime object (or in a column in a DataSet cast as a DateTime), you can use the DateTime's ToString overload to specify the format, such as:

string s = dateVal.ToString("dd/MM/YYYY");

 

I think I saw another thread here where someone did something simpler (such as changing a DB option or using the built-in localization objects - or is it globalization, one for UI one for code -can't rememember).

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...