Grasshopper

algorithmic modeling for Rhino

Hi All,

If anyone else had their heart set on posting a question today, I'll save this one for a rainy day. 

Here's a relatively quick one with a few minor pitfalls along the way.

Using Native Grasshopper components convert a Date and Time String into an MS Excel Date Time Code. It must be exactly what excel would produce.

For those of you who don't know: Excel uses a serial number to handle date and time it is worked out by the number of days from 1-Jan-1900.

Would welcome any Scripts as a secondary exercise or if there is a Plug-in out there with a component just for this let us know.

This was going to be incorporated into another question but I thought I would break it down into easily manageable bites

.

.

...............

SOLUTION MK2 (Leap year adjustment):

....................................................

WINNER: (one horse race) Systemiq

Views: 1432

Attachments:

Replies to This Discussion

I am interested in seeing this one, good topic, strings are one area of GH I have 0% experience in.

Not checked against Excel and dates before 1900 will be wrong.

Hi Systemiq,

Good effort, but I'm afraid your handling of different days in the month and leap years hold up to scrutiny. These were the pitfalls I mentioned :)

The dates 31-May-2011 and 01-Jun-2011 are the same in your method. Where as they should be 40694 and 40695 in the Excel Date Time Code serial number system 

Edit: Sorry that should have said does not hold up to scrutiny

I will stay in the pit and let someone else correct my mistakes so !

I feel lazy =)

Solution Posted Above

@Systemiq have a look at the Find Similar method instead of the Member Index. I noticed when checking yours that I accidently typed July instead of Jul. Find similar can cope with this however Member Index will not find a match.

Good point.

Btw, is divisible by 4 enough to know if it is a leap year ?

Shouldn't also consider modulo 100 and modulo 400 ?

Fixed

so..... will you do the next coffee topic?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service