Page 1 of 1

Datetime Node

Posted: 19 Nov 2014, 09:07
by Drac Zhang
Hi,
When I use Datetime Node I found that it's so unconvientent to do some calculate, such as add some minutes.
So does it possible to add something to do it in the node?

Best Regards
Drac Zhang

Re: Datetime Node

Posted: 25 Nov 2014, 12:06
by lerou
Hi,

DateTime is very simple, use a script and put out whatever you need. See here for string format examples, here for documentation.

See attached vza for Ventuz example.

cheers,
rou

Re: Datetime Node

Posted: 26 Nov 2014, 05:19
by Drac Zhang
Hi,
Thanks for answering.
I know C# script can do this things. But I want to refresh the time every second I have to use a script and a datetime node to validate the new time.
So I think if the datetime node can do this, it will be much more convient.

Best Regards
Drac Zhang

Re: Datetime Node

Posted: 05 Dec 2014, 17:42
by Eric_RD
You Can do that with a simple string Expression.
Create a string Expression with the following inputs:
DateTime, string
Day, int
Hour, int
Minute, int
Second, int

insert this for the Expression:
Convert.ToDateTime(DateTime,new System.Globalization.CultureInfo("en-US")).Add(new System.TimeSpan(Day, Hour, Minute, Second)).ToString()

Now connect the DateTime output of the DateTime Node with the DateTime input of this Expression.
You can now set positive or Negative values for Day, Hour, Min and Second

I'm not sure about the Cultureinfo. Even my System is Set to DD.MM.YYYY (and the DateTime Output shows it that way) it arrives at the String Expression as MM/DD/YYYY so you have to convert this.