Geekpedia Forums Logo

Date and time in C#

by Rana zuhair on Wednesday, September 16th - 5:29 AM



Hello every one,,

I need your help , I've used DateTime class to get the current time but when i use

DateTime dt= DateTime.now;

It shows me both date time, and i need only the current time (HH:MM:SS) .

If you have worked with this class can you please help me

Hi Rana,
   You need to code this,

label1.Text = DateTime.Now.ToShortTimeString();

Hope its helpfull 4 u

Thanks,
its_kk

Thanks for your help.

I've tried this and it works with me :)