Date check

Date check

s.diepstraten
Explorer Explorer
490 Views
2 Replies
Message 1 of 3

Date check

s.diepstraten
Explorer
Explorer

Hi People,


I searched the forum but couldn't find anything about this.
I want ilogic to compare whether the current date is before or after a date in the future. For example 01-01-2024. If true, the program can continue, otherwise it should return a msgbox. Someone help me?

 

0 Likes
Accepted solutions (1)
491 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

This seems more like a VB.net question than a Inventor API question. You should have a look for the DateTime class. You can do stuff like this:

Dim today = DateTime.Now
Dim otherDate = New DateTime(2023, 3, 14)

If (today < otherDate) Then
    Dim timLeft = otherDate - today
    MsgBox(timLeft.Days & " days left to otherDate")
Else
    Dim timLeft = today - otherDate
    MsgBox(timLeft.Days & " days past the otherDate")
End If

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 3

s.diepstraten
Explorer
Explorer

Top. Thx. Exact what i needed.

0 Likes