Formatting Now

  • Thread starter Thread starter reidarT
  • Start date Start date
R

reidarT

I use this in a label
DateTime d1 = DateTime.Now;

this.lblTime.Text = d1.ToString();

but I get the date and time in this format 21.02.2002 23:45:00

I only want 23:45

regards

reidarT
 
I use this in a label
DateTime d1 = DateTime.Now;

this.lblTime.Text = d1.ToString();

but I get the date and time in this format 21.02.2002 23:45:00

I only want 23:45

Look at the help for DateTime.ToString()

this.lblTime.Text = d1.ToString("t");

Joanna
 
Back
Top