TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sai Yang
NA
136
27.4k
[C#] How to get HH:mm from two datetimes?
Apr 6 2018 11:31 AM
hi there,
how to get Duration of log in and log out system in the format of HH:mm from two datetime?
I using this code:
DateTime now = DateTime.Now;
TimeSpan hrs = now - timein;
double z = hrs.TotalHours;
if using system for two hours
z = 2.700123 something like that.
it doesn't support my needed.
what I want is like:
e.g
logintime logouttime duration
06/04/2018 23:04:36 07/04/2018 23:05:08 HH:mm or (e.g) z=24:30
format dd/MM/yyyy HH:mm:ss .
Mean 24 hrs and 30 minutes; after 30 minutes z=25:00 hrs. (not 24.5004343534).
Duration should be more than 24 hour upto days log in if using two days will display like 48:30........
How can I display that????
Best regard;
Reply
Answers (
5
)
Xamarin Development: Trying to Create a Spinner
transfer value from textbox and a table1 to another table2