i want to find just time not date from my computer current time and also find just "day" e.g., monday , tuesday etc from computer current day. pls tell me as soon as possibe.
Asked
Active
Viewed 440 times
-14
-
3You can do it, really! – Divyang Desai Jan 04 '17 at 16:23
-
1That isn't how this site works. If you did any research, you would see this question is asked frequently. – Greg Jan 04 '17 at 16:24
-
1[String Format for DateTime](http://www.csharp-examples.net/string-format-datetime) – Win Jan 04 '17 at 16:25
-
@ttoseeff check my answer, hope it helps – Balaji Marimuthu Jan 04 '17 at 16:57
-
@BalajiM yes it so helpful gratitude – ttoseeff Jan 04 '17 at 17:06
1 Answers
-1
You can get the Day and Time in DateTime object (datestr). Check datestr object to get more information such as month, year, ShortTimeString.
DateTime datestr = DateTime.Now;
datestr.DayOfWeek; //it shows the day ex: monday,tuesday
datestr.ToLongTimeString(); //restult will be time ex: "10:18:19 PM"

Balaji Marimuthu
- 1,940
- 13
- 13
-
-
-
can u tell me that how to add minutes in time. For example, current time is 8:00 AM and i want to add 30 minutes in it. then the time will be 8:30 AM. – ttoseeff Jan 04 '17 at 17:22
-
@ttoseeff Use AddMinutes method datestr.AddMinutes(30).ToShortTimeString() – Balaji Marimuthu Jan 04 '17 at 17:25
-
-
Probably because that is what you get for answering *extremely* low quality questions. OP should try *something* on his own before asking for broad help. – luk2302 Jan 29 '17 at 08:31