Hello

I have the following code to display my time difference on a label and it works fine until my endtime is less ie. "01:00:00" and now() is more ie. "13:00:00"
What can I do to rectify this?

Dim EndTime As New DateTime(Now.Year, Now.Month, Now.Day, My.Settings.EndHour, _
        My.Settings.EndMinute, 0)
        Dim currentTime As Date = DateTime.Now().ToString("HH:mm:ss")
        Dim Timeremain As Date = (EndTime - Now).ToString


        Label8.Text = currentTime
        Label14.Text = Timeremain.ToString("HH:mm:ss")

Recommended Answers

All 2 Replies

You need to format the datetime into 24 hrs format .

or u can put a if condition to conver 13 in to 1.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.