In c# i'm trying to get the time with the following code:
DateTime.Now.ToString("HH:MM");
I fill this value into a ListView. Somehow it allways gives 20:06 but if I add a breakpoint before this point in my code and walk through it step by step it show me a different time while it is still adding 20:06.
Here's how i'm adding it:
ListViewItem item = new ListViewItem(mItem.Naam);
item.SubItems.Add(DateTime.Now.ToString("HH:MM"));
item.SubItems.Add(tafelnummer.ToString());
lstBarOverzicht.Items.Add(item);
When i'm going throug the code step by step and hold the mouse on "Now" then I see DateTime.Now {9-6-2015 21:02:15} but when I check the subitems of item then I see the resultview then I see subitems [1] {20:06}
Just use
DateTime.Now.ToString("HH:mm"))
instead of"HH:MM"
"MM"
is for format as month,"mm"
is for minutes.