PrintSystemJobInfo.StartTimeOfDay Property

Gets the earliest time of day, expressed as the number of minutes after midnight Coordinated Universal Time (UTC) (also called Greenwich Mean Time [GMT]), that the print job can begin printing.

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

public int StartTimeOfDay { get; internal set; }

Property Value

Type: System.Int32
An Int32 specifying the earliest possible start time for the print job, expressed as the number of minutes after midnight (UTC). The maximum value is 1439.

This value is propagated to each PrintSystemJobInfo object from the PrintQueue.StartTimeOfDay property of the hosting PrintQueue at the time the job enters the queue. If PrintQueue.StartTimeOfDay is changed, then any PrintSystemJobInfo.StartTimeOfDay value that is earlier than PrintQueue.StartTimeOfDay is changed to the value of PrintQueue.StartTimeOfDay.

After the job is added to the queue, it can be given a new StartTimeOfDay value through the Microsoft Windows user interface (UI), provided that it is not earlier than PrintQueue.StartTimeOfDay.

If you are not in the UTC time zone, you must add or subtract multiples of 60 to 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. If StartTimeOfDay returns 960, that means 16:00 (4:00 PM) in UTC (because 960/60 = 16). To convert this to Pacific Time, you must subtract 480 (= 8 * 60) minutes.

You also must remember that time rolls over to zero after 24 hours (that is; after the 1439th minute). If StartTimeOfDay returns 120, that means 2:00 AM in UTC. To convert this to Pacific Time, you must subtract 480 minutes, which results in -360. To get a positive value that has meaning, add the negative number to the total minutes in a day, 1440, resulting in a final value of 1080 (6:00 PM) Pacific Time.

See TimeZone, TimeSpan, and DateTime for methods that help make time-zone adjustments.

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

The following example shows how to use this property as part of the process of diagnosing a problematic print job.

private static Boolean ReportAvailabilityAtThisTime(PrintSystemJobInfo theJob)
{
    Boolean available = true;
    if (theJob.StartTimeOfDay != theJob.UntilTimeOfDay) // If the job cannot be printed at all times of 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 (!((theJob.StartTimeOfDay < utcNowAsMinutesAfterMidnight) 
           && 
           (utcNowAsMinutesAfterMidnight < theJob.UntilTimeOfDay)))
        {
            available = false;
        }
    }
    return available;
}//end ReportAvailabilityAtThisTime

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft