C# DateTime ToShortTimeString() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
DateTime

Definition

In C#, DateTime.ToShortTimeString() returns the time of day as short text, with hours and minutes only. With the invariant culture the text is HH:mm, for example 14:30.

The layout comes from the current culture, and some cultures use a 12-hour clock with AM or PM. The method is the same as ToString("t").

This is an instance member of System.DateTime. You call it on a DateTime value, such as dt.ToShortTimeString(...). DateTime is a struct, so every value is copied and never changed in place.

Syntax

Call it on a DateTime. It takes no arguments.

C#
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
DateTime dt = new DateTime(2026, 11, 18, 14, 30, 45);
string s = dt.ToShortTimeString();   // "14:30"
CallWhat it does
dt.ToShortTimeString()Hours and minutes in the current culture.
dt.ToString("t")The same result with a format letter.
dt.ToString("HH:mm", culture)A custom pattern that never changes with the culture.

Seconds are cut off, not rounded. 14:30:59 still shows 14:30.

Library declarations
C#
public string ToShortTimeString();

Parameters

ParameterDescription
NoneToShortTimeString() takes no parameters.

Return Value

Return ValueDescription
stringThe time in the short time pattern of the current culture. The date and seconds are not included.

C# Examples

Example 1 — Hours and Minutes

Print the short time for an afternoon and a night value.

C#
using System;
using System.Globalization;

class Program {
    static void Main() {
        CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
        DateTime afternoon = new DateTime(2026, 11, 18, 14, 30, 45);
        DateTime night = new DateTime(2026, 11, 18, 0, 5, 9);
        Console.WriteLine(afternoon.ToShortTimeString());
        Console.WriteLine(night.ToShortTimeString());
    }
}

How It Works

  1. Fixed culture. Invariant culture uses a 24-hour clock for the short time.
  2. Seconds removed. The 45 seconds of the first value do not appear.
  3. Leading zeros. The second value prints 00:05, with the zero hour kept.
  4. Midnight. Hour 0 is shown as 00, not as 12.

Example 2 — Seconds Are Cut Off

Show that 59.999 seconds does not round up to the next minute, and match ToString("t").

C#
using System;
using System.Globalization;

class Program {
    static void Main() {
        CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
        DateTime t = new DateTime(2026, 11, 18, 14, 30, 59, 999);
        Console.WriteLine(t.ToShortTimeString());
        Console.WriteLine(t.ToShortTimeString() == t.ToString("t"));
    }
}

How It Works

  1. Almost the next minute. The value is 14:30:59.999.
  2. No rounding. The text still says 14:30, because extra parts are simply dropped.
  3. Same as "t". The standard t format gives identical text.
  4. Prints True. Use whichever you find more readable.

Example 3 — A Simple Timetable

Print three time slots from an array of DateTime values.

C#
using System;
using System.Globalization;

class Program {
    static void Main() {
        CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
        DateTime[] slots = {
            new DateTime(2026, 11, 18, 9, 5, 0),
            new DateTime(2026, 11, 18, 13, 45, 0),
            new DateTime(2026, 11, 18, 23, 59, 0)
        };
        foreach (DateTime slot in slots) {
            Console.WriteLine(slot.ToShortTimeString());
        }
    }
}

How It Works

  1. Array initializer. Three DateTime values hold the schedule.
  2. foreach loop. Each value is printed on its own line.
  3. Padded hours. The first slot shows 09:05, with a leading zero.
  4. Date is hidden. Every slot is on November 18, but the output shows only the clock time.

Frequently Asked Questions

Hours and minutes, for example 14:30 in the invariant culture.
Yes. Both use the short time pattern of the current culture.
No. Seconds are dropped, so 14:30:59 still prints 14:30.
Use ToString("HH:mm", CultureInfo.InvariantCulture).
No. Use ToShortDateString or a custom format for the date.

Next: ToString()

Turn a DateTime into text with a format string and an optional culture with System.DateTime.

ToString() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

13 people found this page helpful