Hi friends !
First of all i want to convert system's datetime in string then i want to insert this date in a table.
plz can anybody help me?
Thanks....
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
mouadh trabelsiPosted Feb 2, 2007, 5:32 AM
string
sDate = DateTime.Now.ToString();string requete = "Insert into table_name (date_field) values (CONVERT(DATETIME,'"+sDate+"', 103))";
Scott LyslePosted Jan 28, 2007, 9:07 PM
Now.ToShortDate();
or
Now.ToLongDate();
You can use a custom format as well (e.g.):
DateTime d = new DateTime(1944, 06, 04);
string dday;
dday = String.Format("{0:MMM dd, yyyy}", d);