PrintQueue.StartTimeOfDay Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets 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 printer will print a job.

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

public virtual int StartTimeOfDay { get; set; }

Property Value

Type: System.Int32

The time of day that the printer first becomes available, expressed as the number of minutes after midnight (UTC). The maximum value is 1439. When a printer is first installed by using the Microsoft Windows Add Printer Wizard, the printer defaults to being available all the time, and this property returns 0 in all time zones.

If you are not in the UTC time zone, you must 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 StartTimeOfDay 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 24 hours (that is; after 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.

      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. ";

.NET Framework
Available since 3.0
Return to top