Hello Ventuzians!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
THE FORUMS ARE CLOSED!
Please join our discord server HERE!! << click me
We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server
Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!
OffSet Time zone -Fail
Moderator: Support
OffSet Time zone -Fail
Is there an easy way using the Date & Time node, Covert to Text and an expression node to offset the system time by a number of hours? I just cant figure it!
Have been trying to create a series of clocks each showing a different time zone.
Regards
Peter
Have been trying to create a series of clocks each showing a different time zone.
Regards
Peter
-
- Posts: 666
- Joined: 18 Jan 2012, 20:56
- Location: wuppertal
- Contact:
Re: OffSet Time zone -Fail
do you need just the time or the date also?
if just the time...you get everything you need out of the dateTime node...and just need to ad the offset...of course with a modulo function
greetz
christian
if just the time...you get everything you need out of the dateTime node...and just need to ad the offset...of course with a modulo function
greetz
christian
- Daniel Willer
- Posts: 309
- Joined: 06 Jan 2012, 18:12
Re: OffSet Time zone -Fail
There are several DateTime Methods in .Net you can use inside a little Script or even an expression.
Check http://msdn.microsoft.com for further info.
D
Check http://msdn.microsoft.com for further info.
D
Re: OffSet Time zone -Fail
Hi Chris & Daniel
Thanks for that. Yes I have that working OK by taking the hours and minutes as separate items from the DateTime node and + or - the hours with the modulo working fine.
What I was trying to do, is what Daniel mentioned in the next post buy using an expression and DateTime AddHours. I can see loads of examples that would work in a script but cant get it working inside an expression. Just cant get the syntax right to allow it to compile correctly. Ventuz Help in this case is No Help as no examples.
Regards
Peter
Thanks for that. Yes I have that working OK by taking the hours and minutes as separate items from the DateTime node and + or - the hours with the modulo working fine.
What I was trying to do, is what Daniel mentioned in the next post buy using an expression and DateTime AddHours. I can see loads of examples that would work in a script but cant get it working inside an expression. Just cant get the syntax right to allow it to compile correctly. Ventuz Help in this case is No Help as no examples.
Regards
Peter
Re: OffSet Time zone -Fail
quick example, you just need to add the string outputs to the script. (i.e 'istHour' etc)
you can use any local system time zones.
chris
you can use any local system time zones.
chris
Code: Select all
DateTime dt = DateTime.Now;
var ist = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dt, TimeZoneInfo.Local.Id, "India Standard Time");
istHour = ist.Hour.ToString();
var pt = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dt, TimeZoneInfo.Local.Id, "Pacific Standard Time");
ptHour = pt.Hour.ToString();
var ct = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(dt, TimeZoneInfo.Local.Id, "Central Standard Time");
ctHour = ct.Hour.ToString();
Re: OffSet Time zone -Fail
forgot to mention this just gives you the hours as an output not min and secs but thats all your after i guess
chris
chris
- Daniel Willer
- Posts: 309
- Joined: 06 Jan 2012, 18:12
Re: OffSet Time zone -Fail
It is a little tricky to do it in a expression.
Because the expression nodes does not have the type DateTime you have to parse the value inside the expression to DateTime, add the hours and convert back to a string.
Just take a string expresion node and add the follwoing expression
Because the expression nodes does not have the type DateTime you have to parse the value inside the expression to DateTime, add the hours and convert back to a string.
Just take a string expresion node and add the follwoing expression
Code: Select all
DateTime.Parse(A, System.Globalization.CultureInfo.InvariantCulture).AddHours(2).ToString("hh")
Re: OffSet Time zone -Fail
Thank you both for most elegant solutions.
Daniel, each time I encounter such a concise and beautiful solution I know I have so many things to learn in Ventuz.
Regards
Peter
Daniel, each time I encounter such a concise and beautiful solution I know I have so many things to learn in Ventuz.
Regards
Peter