Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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 Value

Type: System.Int32

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

      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
Show:
© 2016 Microsoft