vMix Forums
»
General
»
General Discussion
»
Time zone time of day script
Rank: Member
Groups: Registered
Joined: 9/17/2020(UTC) Posts: 18 Location: Leeds Thanks: 2 times Was thanked: 3 time(s) in 3 post(s)
|
So i've spent AAAAAGGGGGEEEEESSSSS looking and trying to work out how to display the current time in a specific time zone as a title and include the time zone initials AND have it loop as a continuous time. I had worked it out a few weeks ago but then a subsequent vmix re-install and I lost it so i'm putting in here for anyone else wanting it and my own benefit if i lose it again. All is compared against UTC. Create vmix time input and then enter this into the scripting module EDIT: - Have tidied these up a little to be a bit more user friendly and more efficient for the computer. Code:
'Time of Day for GMT time zone - BUT ADAPT AS NECESSARY
'Set your Time Zone Offset to universal time coordinated eg. New York -5hrs or Sydney +11
Dim tzo as integer
tzo = 0
'Set your Time Zone Initials - eg. EST - Eastern Standard time
Dim tzi as string
tzi = " GMT"
'Set the vmix input name to write the timer to
Dim ipname as string
ipname = "daytime"
Dim newtime as string
Dim currenttime as string
currenttime = newtime + tzi
Do while true
newtime = datetime.utcnow.addhours(tzo).tostring("HH:mm:ss")
currenttime = newtime + tzi
API.Function("Settext", input:=ipname, selectedindex:="0", value:=currenttime)
Sleep(300)
Loop
Code:
'Time of Day for CET time zone - BUT ADAPT AS NECESSARY
'Set your Time Zone Offset to universal time coordinated eg. New York -5hrs or Sydney +11
Dim tzo as integer
tzo = +1
'Set your Time Zone Initials - eg. EST - Eastern Standard time
Dim tzi as string
tzi = " CET"
'Set the vmix input name to write the timer to
Dim ipname as string
ipname = "daytime"
Dim newtime as string
Dim currenttime as string
currenttime = newtime + tzi
Do while true
newtime = datetime.utcnow.addhours(tzo).tostring("HH:mm:ss")
currenttime = newtime + tzi
API.Function("Settext", input:=ipname, selectedindex:="0", value:=currenttime)
Sleep(300)
Loop
Another neat trick is to create a browser input and put the following into the address field so that the script auto starts when you open your preset - "http://localhost:8088/API/?Function=scriptstart&value=nameofscript"
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,221 Location: Belgium Thanks: 293 times Was thanked: 955 time(s) in 790 post(s)
|
Would be nice if the code was put in (language) quotes ! Code:Dim d1 As DateTime = DateTime.Now.AddHours(3)
API.Function("SetText",Input:=45,SelectedIndex:="0" ,Value:=d1.ToString("dd/MM/yy H:mm:ss"))
Glad you figured it out though :-)
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 9/17/2020(UTC) Posts: 18 Location: Leeds Thanks: 2 times Was thanked: 3 time(s) in 3 post(s)
|
Originally Posted by: doggy Would be nice if the code was put in (language) quotes ! Code:Dim d1 As DateTime = DateTime.Now.AddHours(3)
API.Function("SetText",Input:=45,SelectedIndex:="0" ,Value:=d1.ToString("dd/MM/yy H:mm:ss"))
Glad you figured it out though :-) Learned a new thing! Didn’t know how to do language quotes. Done. 👍
|
1 user thanked njfeathe85 for this useful post.
|
|
|
vMix Forums
»
General
»
General Discussion
»
Time zone time of day script
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close