Solved

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

Posted on 2011-03-21
3
579 Views
Last Modified: 2013-12-17
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
0
Comment
Question by:gudidi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
morgulo earned 500 total points
ID: 35186907
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
 
LVL 9

Expert Comment

by:mayank_joshi
ID: 35186911
use

Formate(testDate,"MDY")

Open in new window


where testDate is Date or DateTime datatype.
0
 
LVL 9

Expert Comment

by:mayank_joshi
ID: 35186933
sorry use:-

      

Format(testDate,"Mdyy")

Open in new window

or      

Format(testDate,"Mdyyyy")

Open in new window

0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question