The TimeJobSubmitted
attribute does not appear to return the time in the correct Time Zone. When I manually look at the Print Queue in Windows, I can see that the time is correct on the job. (Example: Displays Job1 submitted at 3:30);
The issue is when parsing through the print job in code using the PrintJobInfoCollection
, it does not appear to be using the correct timezone because it says the TimeJobSubmitted
is 8:30, opposed to the correct value, 3:30 displayed in the actual Print Queue seen in windows. (Right click the printer and click "See What's Printing" to see the Print Queue in windows.
Here is how I look through the Print Queue in code.
LocalPrintServer server = new LocalPrintServer();
PrintQueue pq = server.GetPrintQueue(printerName);
if (pq != null)
{
pq.Refresh();
PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection();
foreach (PrintSystemJobInfo job in jobs)
{
string jobName = job.Name;
string jobStatus = job.JobStatus.ToString();
// Why is the next line 5 hours off of the correct time?
DateTime timeSubbited = job.TimeJobSubmitted;
DateTime currentTime = DateTime.Now;;
TimeSpan elapsed = currentTime - timeSubbited;
// double minutesPassed = timePassed.TotalMinutes;
}
}
How do I get the correct TimeJobSubmitted when iterating the print jobs in c#?