AnsweredAssumed Answered

Read Last Save Date of a SolidWorks file in PDM Pro

Question asked by Steve Anderson on Apr 17, 2019
Latest reply on Apr 22, 2019 by Steve Anderson

I am stuck in the time space continuim.  With Easter this week, imagine going back to the year 1600, or 0001. 

 

I have what I feel is some really simple code.  We are comparing the PDF file dates that are created through the PDM workflows with the file date of the drawing.

 

Example 1:

Dim date1 As Date = IO.File.GetLastWriteTime(DrawingFile)

Dim date2 As Date = IO.File.GetLastWriteTime("H:\M1\SW_PDF\" & AF(c) & ".PDF")

Dim result As Integer = DateTime.Compare(date1, date2)

Debug.WriteLine(date1.ToString & " > " & date2.ToString & " = " & result)

 

The code above produces: 12/31/1600 6:00:00 PM > 3/29/2019 8:09:03 AM = -1

 

Example 2:

DrawingFile is the full path

Dim swFile As IEdmFile7 = VAULT.GetFileFromPath(DrawingFile)

Dim swDate As String = swFile.GetLocalFileDate(DrawingFile)

 

Dim date1 As Date = Convert.ToDateTime(swDate)

Dim date2 As Date = IO.File.GetLastWriteTime("H:\M1\SW_PDF\" & AF(c) & ".PDF")

Dim result As Integer = DateTime.Compare(date1, date2)

Debug.WriteLine(date1.ToString & " > " & date2.ToString & " = " & result)

 

The code above produces: 01/01/0001 12:00:00 AM > 3/29/2019 8:09:03 AM = -1

 

The difficulty is, we need to make sure the PDF file last saved date is greater than the drawing last saved date, which means it is up to date.

Our reseller says its a bug, I am wondering if they have somehow added a flex capacitor to the software.

 

Let me know if you can shed any light.

 

Thank you!

 

 

Outcomes