0
Hi Shree,
As per your requirement, you want to insert User Entered Date along with System Current time then try this :
DateTime time = DateTime.Now;
string FormatedDate = "11/02/11"+" "+time.ToLongTimeString(); //here replace your date which is entered by user
DateTime date = DateTime.Parse(FormatedDate);
and finally insert date obj into database, for e.g :
string query = "insert into TableName values('" + date + "')";
0
refer example:
select CONVERT(VARCHAR,column name,101) + ' ' + CONVERT(VARCHAR,SYSDATETIME(),108)
0
Thanks for Reply .
i am taking date from user into my form,
according to system time , can it save current time along with the entering date into database .
0
I think i forget to see the category, if your post is just related with Database concept then,
as per your question, when your inserting/selecting date only from datetime Use CONVERT(VARCHAR(30),ColumnName/Value,111)
and for current datetime , select convert(varchar, getdate(), 1)
0
Hi Shree,
1. If binding data thro' SqlDataSource then in <asp:BoundField
Use DataFormatString = "{0:d}" , its a format pattern for GridView to display Short date
2. if Binding thro' SqlDataAdapter then in query Use
CONVERT(VARCHAR(30),ColumnName,111) , it will return date part from datetime
3. For displaying Date only from current Time
DateTime time = DateTime.Now;
Response.Write(time.ToShortDateString());
0
use .ToShortDateTime() with your datetime variable...