davidstern100 wrote:
In C#, the date in DateTime uses slashes ("/").
It depends on your locale. A DateTime does not store dates with slashes. That is only how they are rendered in your locale.
davidstern100 wrote:
How do I change the format in order to save dates (like DateTime.Now) in my sql database?
Dates are stored as SMALLDATETIME or DATETIME types, not in any specific format with dashes, slashes or whatever. It is the responsibility of the presentation layer to render the dates in a human readable form. If you are attempting to inject a date into a SQL statement in order to make up something like this: INSERT MyTable(SomeDate) VALUES ('2006-01-28') then I suggest you don't. Use Parameterised queries instead. If you tell us exactly why (in other words, to what higher purpose) you want to convert dates in this way we may be able to suggest a better solution.
Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos