how to convert date to be allways MDY for insert to SQL

Hi Experts

i have business layer in C# with property for each column, some of them are date.
i need to insert in one format to database MDY.
how do i configure the property set to set allways the date by MDY,
consider that the OS can be UK or US ???
i don't know in the application which OS sent me the date...

10x a lot
gudidiAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
morguloConnect With a Mentor Commented:
The formatting is used only if you change date to string and string to date. Dates stored in database are in binary format, independed from formatting. If you want see dates in specific format in your app you must format dates (when converting to string) in app using local settings - date.ToString(IFormatProvider)
0
 
mayank_joshiCommented:
use

Formate(testDate,"MDY")

Open in new window


where testDate is Date or DateTime datatype.
0
 
mayank_joshiCommented:
sorry use:-

      

Format(testDate,"Mdyy")

Open in new window

or      

Format(testDate,"Mdyyyy")

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.