I have a GridView and SqlDataSource,
I have a column type: DateTime. If I type only the date in the TextBox, then the time will be 00:00:00. Is there any way of auto adding the current time if is not specified?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you type only the date in the
TextBoxyou can still submit and add the current time onto the Date.DateTime has an
Addfunction that allows you to add aTimeSpanto get a newDateTimeobject.If you add the current time of day (
DateTime.Now.TimeOfDay) to the input you gathered, you will get a newDateTimeobject with the current time of day and the date that was input.