Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel
titleCode Examples
Code Block
languagepy
titleCode Snippet
# This example would add two days to the date passed in.
 
today = system.date.now()
twoDaysFromToday = system.date.addDays(today, 2)
Code Block
languagepy
titleCode Snippet
# This example would subtract 20 minutes from a date object we create.
# Even though our original date starts on the 28th, it starts at midnight,
# so subtracting 20 minutes puts it at the previous day.
 
date = system.date.getDate(2020, 5, 25) # This would print out like MonThu MayJun 25 00:00:00 PDT 2020
print system.date.addMinutes(date, -20) # This will print SunWed MayJun 24 23:40:00 PDT 2020
Code Block
languagepy
titleCode Snippet
# This example can be placed on the property change script of one Vision Calendar component.
# It will then automatically set a second calendar component two weeks in advance of the first calendar's selected date.
if event.propertyName == "date":
	date = event.newValue
	event.source.parent.getComponent('End Date Calendar').date = system.date.addWeeks(date, 2)

...