Dates in Dynamo

I just spent a couple of hours trying to get some dates to work…

But Dynamo reads American dates and the nodes don’t work with normal dates…

I gave up and used Python… but is is possible to get total days using international format dates?

The most annoying thing is localizing datetime or other units…In Pyhton it does not work… I don’t know why…


1 Like

Ah, I did pretty much the same in Python.
Split the string and swapped the order.

A solution by specifying the format

import sys
import clr
import System
from System import DateTime

dt = DateTime.ParseExact(IN[0], "d/M/yyyy",  System.Globalization.CultureInfo.InvariantCulture)

OUT = dt


Kinda crazy how the dynamo nodes only work for America tho. :expressionless:


Seems the (input for) format(ting) is (was) the issue no?

This isn’t an issue unique to Dynamo. DateTime objects in general are a pain unless you know what format they are in. This is why every web form expected to work at scale specifies the format (ie: yyyymmdd) or utilizes a dropdown to control the data format.

This is compounded by some dates having no clear way to parse programmatically (ie: 09/08/07 could be one of six dates).

And so programmers everywhere have had to deal with the lack of standard in every tool ever built by specifying the format directly.

PS: the ISO standard is the best date format.

No. The issue is that DateTime.FromString doesn’t work with anything but American dates and the DateTime.Format doesn’t work with a string.

See the image in my original post.

The Dyno nodes only work with American dates though?
Be good if they worked for the rest of the world too.

Revit has the same issue too which is really annoying/ time consuming. :anguished:

1 Like

I didn’t understand that from the image.

This made it waaaay clearer. At least for me :wink:


1 Like

They do though. The nulls are from not using 4 digits in the year.


They don’t (like @Alien said), or i am completely misunderstanding the issue @jacob.small
In your example 8/11 and 11/8 can be both an US date and thus works.
In other words mm/dd/yy works and dd/mm/yy does not.

Ah! I see the issue now - it’s the dd/mm vs mm/dd, not the year order…

Sadly there isn’t a way to parse this automatically without additional input to explicitly state the formatting. Lemme think on it.

1 Like

I didn’t understand at first too untill

Maybe someone can make a node similar to the DateTime.FromString, but with an option to choose the format (of the input). I guess people tried it already with no luck (with the Python code).

@c.poupin Python didn’t work for me.

can you show the error ?

I used Python -

What I was trying to do was a little different.

I was trying to find the difference in time between today and a list of dates… Then output true / false depending on whether each date in the list was within the last week or not.

Load the Python Standard and DesignScript Libraries

import sys
import clr
from Autodesk.DesignScript.Geometry import *
import datetime

today’s date yyyy / mm / dd

today =
issuedates = IN[0]
outputlist =

Split dates of sheet issues from Revit into dd / mm / yy

breakdatesup =
for issue in issuedates:

for index, item in enumerate(breakdatesup):
#Add 2000 to make it a 4 date year
year = int(item[2]) + 2000
#Get Revit issues in yank format
date =, int(item[1]), int(item[0]))
#Get difference of time between today and the issue
diff = str(today - date)
x = int(diff.split()[0])
#is the Revit sheet issue date within a week of today’s date?
if x <= 7:

OUT = outputlist


Nevermind. I already saw what was wrong. The day has to be TWO digits.

No idea if you can make it work for both one or two digits? @c.poupin

I guess still is still not the result ‘we’ are after (dd/MM). This date stuff is confusing :crazy_face:.

replace "dd/MM/yyyy" by "d/M/yyyy"