Moldflow Insight Forum
Welcome to Autodesk’s Moldflow Insight Forums. Share your knowledge, ask questions, and explore popular Moldflow Insight topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API: Time in Moldflow Log

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
jh_lee
372 Views, 4 Replies

API: Time in Moldflow Log

Log log when analysis is completed

 

Execution time
Analysis commenced at Mon May 30 13:47:11 2022
Analysis completed at Mon May 30 13:48:43 2022
CPU time used 514.84 s
Elapsed wall clock time 92.00 s
equivalent to 0 hr, 1 min

-----------------------------------------------------

 Out file

 

9999989    -> cmmesage.dat (MSCD)
2
1653886031 --> Analysis commenced at Mon May 30 13:47:11 2022
1653886123 --> Analysis completed at Mon May 30 13:48:43 2022
1
514.84375
302134
0
1
92
221056
0
2
0
1

------------------------------------------------------------------------

I would like to know how to display the corresponding value like Log.

Does anyone know how?

Tags (4)
Labels (4)
4 REPLIES 4
Message 2 of 5
bernor_mf
in reply to: jh_lee

Hi,
the integer value is referring to unix start time "1/1/1970"
The integer value could then be converted to date and time.
But will be in UTC.
Then convert UTC to Local.

Below example code.

 

    Public Function UnixTimeToDate(ByVal Timestamp)
        Const BaseDate = "1/1/1970"     
        UnixTimeToDate = DateAdd("s", Timestamp, BaseDate)
    End Function

    MsgBox UnixTimeToDate(1653886031),,"UnixTimeToDate"
    
    varTime = UnixTimeToDate(1653886031)

    Dim myObj, MyDate
    MyDate = CDate( varTime )
    Set myObj = CreateObject( "WbemScripting.SWbemDateTime" )
    myObj.Year = Year( MyDate )
    myObj.Month = Month( MyDate )
    myObj.Day = Day( MyDate )
    myObj.Hours = Hour( MyDate )
    myObj.Minutes = Minute( myDate )
    myObj.Seconds = Second( myDate )
    ConvertUTCToLocal = myObj.GetVarDate( True )

    MsgBox ConvertUTCToLocal,,"ConvertUTCToLocal"

 

 

For your integer, above code returns on my machine:

UnixTimeToDAte 2022-05-31.png

ConvertUTCToLocal 2022-05-31.png

Try on your side to see result and format.

 

Have not researched how to convert to exactly the same format as in Analysis Log.

You could do some format changes to get it as wished, I think.

Add this to above code get a hint of what it could look like.

MsgBox MonthName(Month(varTime)) & " " & Day(varTime),,"MonthName"

MsgBox FormatDateTime(varTime,1) ,,"FormatDateTime 1" 

Reference:
(https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/formatdatetime-f...

 

Hope this helps.
Regards,
Berndt

( If my comments are accepted, provide "Kudos" as appreciation. If your request is answered/resolved, please click the "Accept as Solution" button. Thanks.)
Message 3 of 5
jh_lee
in reply to: jh_lee

Hi. Berndt.

This solution is the best answer for me.

thank you.

Lee.

Message 4 of 5
jh_lee
in reply to: bernor_mf

Hi. Berndt.
This solution is the best answer for me.
thank you.
Lee.
Message 5 of 5
bernor_mf
in reply to: jh_lee

Hi Lee,

thank you for the feedback.

Your are welcome.

Happy to hear this resolves your issue.😊

 

Regards,

Berndt

( If my comments are accepted, provide "Kudos" as appreciation. If your request is answered/resolved, please click the "Accept as Solution" button. Thanks.)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report