0
TimeJobSubmitted
属性似乎不会在正确的时区中返回时间。当我手动查看Windows中的打印队列时,我可以看到工作时间是正确的。 (例如:显示在3:30提交的Job1);PrintSystemJobInfo.TimeJobSubmitted报告错误时间?
问题是使用PrintJobInfoCollection
解析代码中的打印作业时,它似乎没有使用正确的时区,因为它表示TimeJobSubmitted
是8:30,与正确的值相反,3:30显示在在窗口中看到的实际打印队列。 (右键单击打印机,并单击“看看有什么打印”看到打印队列中的窗口。
这是我如何通过在代码中的打印队列中查看。
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;
}
}
我如何得到正确的TimeJobSubmitted在C#迭代的打印作业时?