droiddeve says:
HI,
When i try to insert the date Time Into Sqlserver its Always saving With default DateTime 2016-11-16 11:11:00.000
i cross checked my System Time Too Also its Fine
But When i try to Insert the DateTime From SQl Query Its Perfectly inserting With Current Date And Time 2016-11-16 11:15:26.653
If you are using Storedprocedure then use below code.
delcare @CurrntDt datetime
set @CurrntDt = GETDATE()
insert the @CurrntDt in requiredfield, if you save the value from webpage then use below code
string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff",CultureInfo.InvariantCulture);
OR
string datetime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff",CultureInfo.InvariantCulture);
using System.Globalization;
Add above namespace for adding CultureInfo.InvariantCulture