I am adding 12 hours to the current time. but the current time is displayed in the text box, what is wrong with the code
DateTime expiresAt = System.DateTime.Now.AddHours(12);
txt_ExpiresBy.Text = expiresAt.ToString(@"dd/MM/yyyy hh:mm:ss");
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.
Maybe you are adding 12 hours and you don’t see the difference between X AM and X PM?
Try using
HH(hour in 24 hours format) instead ofhh(hour in 12 hours format) in the format string, or adding the AM/PM indicatortt:See Custom Date and Time Format Strings for a complete reference.