Add a date to generic models

Hello everyone,

First, I’m a beginner in Dynamo, don’t blame me if I ask a dumb question (even if there is no dumb questions) :).

I started to create a dynamo program to add automaticaly the date in a generic models.

So, I managed to add a text (like “30/03/2016”) to a shared parameter in Revit but I’m not able to retrieve the date of today.

Explication: When I add a generic model, the default value is “a” and the program changes the value if the “a” is detected.

If there is no “a” in the shared parameter, the program does nothing (so the existing date doesn’t change).

Note: I do this to 3 families so it’s a little mess.

Capture

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Now the problem is to retrieve the date.

So I tried with DateTime.Today and DateTime.Components to retrieve the value of the day, the month and the year, and now I would like to combine them to a string but I didn’t find the solution yet, so I’m here :slight_smile:

I’m here for the moment:

Capture1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I’m French so the date format is DAY/MONTH/YEAR and I used List.WithLeadingsZeroes because I want a XX format for months (like march is “3” in dynamo and I want “03”).

My goal was to retrieve each value and add them in a codeblock and part them with a “/”.

So my question is: how to add a date (DAY/MONTH/YEAR) to a string?

Thanks you in advance!

Ok, I just found it myself now :slight_smile:

The package SpringNodes help a lot, I just had to use the Numer.ToString and combine them with String.Join :slight_smile:

Just the fact to ask a question here help me I suppose :slight_smile: