I currently use:
lable1.Text = DateTime.Now.ToShortDateString();
to display the short date time in my label1
.
Because the code above shows the date from windows machine (if you change the date in windows clock settings date in program is also changed) this doesn't help me any more. I need to display the GMT date and time in label1
(GMT+0 date) and label2 (GMT+0 clock), so that the date and time will be displayed independent from windows machine clock settings.
I don't have any clue how to make this. Remember that I have a 24 hour system not 12.
Use UtcNow
property like this:
label1.Text = DateTime.UtcNow.ToShortDateString();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With