Changing date/time format in dynamo

excel

#1

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


#2

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”


#3

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


#4

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


#5

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"];

#6

Just updated to latest dynamo release and it is now available

Many Thanks.


#7

Thanks,

This also works well.


#8

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


#9

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