I have a webform which accepts DATE in "DD/MM/YYYY". I want to store it in my MS SQL database in "SQL accepted date format". 
I also have another page which displays summary of my table in another webform, where I do not want to display date in "YYYY/MM/DD". could someone show some pointers
1 Answer
In the database: do not store dates as strings. Store them as datetime, or date, or datetime2.
In your app's SQL code: do not pass dates as strings. Pass them as DateTime parameters
In your app's main code logic: do not pass dates as strings. Pass them as DateTime
So; in your app's UI-level code:
- when taking input, use DateTime.Parse(etc) to convert the user's input to aDateTimebefore passing it down; if that meansParseExact/TryParseExactspecifying"dd/MM/yyyy"- then fine
- when displaying values from the DB, use the type's formatting features to display it in any way you choose
4 Comments
Fka
 If your application is "inter-technological", then you can convert date to epoch timestamp and use it on the edges of systems.
  Marc Gravell
 @Fka the real question there is: what epoch and scale? unix time is just one option of many; but yes, anything that isn't a string is good
  Fka
 Marc - I assumed we talk about dates, not datetimes or anything below days. Can you provide examples of other options?
  Marc Gravell
 @Fka sure; you could talk seconds or milliseconds since 1970 (even for whole days), you could talk ticks from "common era" (i.e. the BCE/CE divide); you could talk "days since 2015" (if your company started in 2015, for example) - or "hours since 2015" - tons of options - entirely arbitrary, as long as both sides agree on what it means
  


DateTimeobjects does not have format. You should save your date asDateTimeobjects, then when displaying it - format.DateTime. And because it's a direct answer to my interpretation of the question I choose this one.