Grasshopper

algorithmic modeling for Rhino

Hi,

how do I get TimeDate functions to work in a VB.Net component in Grasshopper?

I have a list with dates coming into the component and I want to find out how many days there are between the smallest date in the list and the end of that year.

I tried "DayOfYear(x)" [where x is a list of dates that grasshopper is reading from Excel] but Grasshopper tells me that DayOfYear is not declared and that it might not be accessible due to its protection level.

 

[also, I'm never sure how to output a list out of a vb component when I have a input list... - I suppose that is a 101 level question...]

 

thanks for any pointers,

wim

Views: 341

Replies to This Discussion

Hi Wim,

 

a DateTime structure is nothing more than an Int64 number that represents the total number of ticks (1 tick = 100 nanoseconds) since midnight, jan 1st, year 0001. You can use a DateTime to find which day of the week, day of the month, day of the year, month of the year etc. it represents.

 

A TimeSpan structure is also just an Int64 number of ticks, but instead of representing a specific date, it represents a duration. So when you subtract two DateTimes (say, today noon minus last monday 9am) you end up with a TimeSpan structure. You can query TimeSpans to see how many days, hours, minutes, seconds etc. they contain. Have a look at TimeSpan.TotalHours for example.

 

--

David Rutten

david@mcneel.com

Seattle, WA

Thanks David!

That gives me something to work from.

 

groetjes,

wim

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service