Changing date/time format in dynamo

Hello,

Please, could you advise if there is a way to convert the date/time format imported from excel into dynamo to a different format? as follows:

current format: February 08, 2017, 04:47PM
required format: 2018-02-08T16:47 (to suit COBie time format)

Many Thanks

Using OOTB date nodes:

You need to specify the output format following a particular notation that can be found at “Custom Date and Time Format Strings”

1 Like

alvpickmans

Many Thanks for the response, I can’t seem to find the DateTime.Format Node?

I am using revit 2016 and dynamo 1.2.

Thanks

I believe it was released on Dynamo version 1.3 :slight_smile:

Hi @davebull1979

Try this:

Copy paste this in code block:

dt=DSCore.DateTime.Components(dt1);
dt2=dt["year"]+"/"+dt["month"]+"/"+dt["day"]+"T"+dt["hour"]+":"+dt["minute"];
1 Like

Just updated to latest dynamo release and it is now available

Many Thanks.

Thanks,

This also works well.

@davebull1979 Please mark the post as solved. You’re welcome!

@davebull1979 @alvpickmans And here is python magic :smile:

2 Likes