try this below
DateTime myDateTime = DateTime.Now;
string sqlFormattedDate = myDateTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
More Related Contents:
- insert datetime value in sql database with c#
- Days between two dates in asp.net
- how to get date difference between two dates using DateDiff Excluding the weekends [duplicate]
- How do I calculate someone’s age based on a DateTime type birthday?
- C# Data Connections Best Practice?
- Read SQL Table into C# DataTable
- format date in c#
- LINQ to SQL – Left Outer Join with multiple join conditions
- How do I convert an ISO8601 TimeSpan to a C# TimeSpan?
- How to save image in database using C# [closed]
- Why DateTime.AddHours doesn’t seem to work?
- What’s a good way to overwrite DateTime.Now during testing?
- DateTime and CultureInfo
- Datetime in C# add days
- How do I get modified date from file in C# on Windows Mobile?
- The C# using statement, SQL, and SqlConnection
- C# constructing parameter query SQL – LIKE %
- Generate class from database table
- How frequent is DateTime.Now updated ? or is there a more precise API to get the current time?
- What is passing parameters to SQL and why do I need it?
- How can i format 07/03/2012 to March 7th,2012 in c# [duplicate]
- Calling a SQL User-defined function in a LINQ query
- Days, hours, minutes, seconds between two dates
- Enabling Foreign key constraints in SQLite
- no overload for method “ToString” takes 1 arguments
- How to get the integer value of day of week
- Convert DateTime to long and also the other way around
- Generating sql code programmatically
- Do we have transactions in MS-Access?
- Prevent timezone conversion on deserialization of DateTime value