5
Reply

C# date formating problem

Ask a question
Vinnie

Vinnie

17y
4.7k
1

Hi,

I would like to get dd/mm/yy 23:59 format of my date in the text box in aspx.cs code.

First, I select the date from the database into textbox as dd/mm/yy hh:mi, and then
I have to transform it to dd/mm/yy 23:59

Now I do this with this code

string MyDate    //which I get from the function and then

textbox1.Text = MyDate.Remove(9)+ "23:59";

Do you know some better solution to do the same but without remove ?

Also, when user insert date like dd/mm/yy without hh:mm, I would like to change it to

"dd/mm/yy 23:59".

How can I check whether the hh:mm part is not inserted ?

Thanks a lot !


Answers (5)