Remove time portion of Date property value

Remove time portion of Date property value

Anonymous
Not applicable
893 Views
5 Replies
Message 1 of 6

Remove time portion of Date property value

Anonymous
Not applicable

I have a rule that grabs the value of a particular custom date property and sets another custom date property to that value when the rule is run.

 

Date Property B = Date Property A

 

My problem is this: sometimes the value of Date Property A contains the time. When I copy this value to Property B, and property B is used to create a folder path, it causes problems. Is there a way I can strip the time out of the property value? BTW, the time does not show in the properties dialog in IV.

 

Custom Property dialogCustom Property dialog

 

Actual value of propertyActual value of property

My code looks like this:

'Some Code

oToday = iProperties.Value("Custom", "Rev Date")

iProperties.Value("Custom", "Dwg Request Date") = oToday

'Some Code

If there was some string split function I could perform on oToday, to strip the time off the end it would be great.

Anybody have any ideas?

0 Likes
Accepted solutions (1)
894 Views
5 Replies
Replies (5)
Message 2 of 6

cmcconnell
Collaborator
Collaborator

Sorry - this was posted by me with the wrong account. :(Smiley Sad

Mechanix Design Solutions inc.
0 Likes
Message 3 of 6

lmc.engineering
Advocate
Advocate
Accepted solution

Hi @cmcconnell

 

You can use a split function on the string and take the first instance of the new string:

 

SyntaxEditor Code Snippet

oToday = "11/2/2018 9:53:25 AM"
myString = oToday
sDate = myString.Split(" ") (0)

 

0 Likes
Message 4 of 6

bradeneuropeArthur
Mentor
Mentor
  1. Today.year
  2. Today.month
  3. Today.day

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 6

cmcconnell
Collaborator
Collaborator

I was able to get this to work using your solution - thanks!

Mechanix Design Solutions inc.
0 Likes
Message 6 of 6

bradeneuropeArthur
Mentor
Mentor

maybe this is much easier

 

msgbox (date.Today)

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes