PrintQueue.UntilTimeOfDay Property

Gets or sets the latest time, expressed as the number of minutes after midnight Coordinated Universal Time (UTC) (also called Greenwich Mean Time [GMT]), that the printer will print a job.

Namespace: System.Printing
Assembly: System.Printing (in system.printing.dll)

public virtual int UntilTimeOfDay { get; set; }
/** @property */
public int get_UntilTimeOfDay ()

/** @property */
public void set_UntilTimeOfDay (int inUntilTime)

public function get UntilTimeOfDay () : int

public function set UntilTimeOfDay (inUntilTime : int)

Not applicable.

Property Value

An Int32 specifying the time of day that the printer is no longer available, expressed as the number of minutes after midnight (UTC). The maximum value is 1439. When a printer is first installed using the Microsoft Windows Add Printer Wizard, the printer will default to being available all the time and this property will return 0 in all time zones.

If you are not in the UTC time zone, you will need to add or subtract multiples of 60 to set or get the correct time for your time zone. For example, if you are in the Pacific Time Zone of North America and daylight savings time is not in effect, then your local time is 8 hours earlier than UTC. To set UntilTimeOfDay to 12 AM in your time zone, you set it to 8 AM UTC, which is 480 (= 8 * 60). You also must remember that time rolls over to zero after the 24th hour (the 1439th minute). To set it to 6 PM in your time zone, you set it to 2 AM UTC, which is 120 (= 2 * 60). See TimeZone, TimeSpan, and DateTime classes for helpful time zone manipulating methods.

If the printer is always available, then this property returns 0 in all time zones.

The following example shows how to use this property to determine whether a printer is available at the present time. For the complete sample, see Survey Status of Printers Sample.

private static void ReportAvailabilityAtThisTime(ref String statusReport, PrintQueue pq)
    if (pq.StartTimeOfDay != pq.UntilTimeOfDay) // If the printer is not available 24 hours a day
DateTime utcNow = DateTime.UtcNow;
Int32 utcNowAsMinutesAfterMidnight = (utcNow.TimeOfDay.Hours * 60) + utcNow.TimeOfDay.Minutes;
        // If now is not within the range of available times . . .
        if (!((pq.StartTimeOfDay < utcNowAsMinutesAfterMidnight) 
           (utcNowAsMinutesAfterMidnight < pq.UntilTimeOfDay)))
            statusReport = statusReport + " Is not available at this time of day. ";

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0