DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Add milliseconds to a time channel entry

I am having a problem trying to add milliseconds to a time channel entry.   Currently I am using the DateAdd Function but it does not work. 

The millisecond range is in bold in the following text.

07/01/2008 10:05:00.0000 ' I am getting this out

07/01/2008 10:05:00.3000 ' I need this out

 

 The following script is an example of what I am trying to do

 

dim MuteStartTime
dim MuteDurTime
dim mutestoptime
MuteStartTime = Now  
MuteDurTime   = ".3"

MuteStopTime = DateAdd("s", MuteDurTime, MuteStartTime)  
msgbox "(Start " & RTT(MuteStartTime) & ") + (Duration " & MuteDurTime & " Sec) = (Stop " & RTT(MuteStopTime)&")"

 

BBANACKI
0 Kudos
Message 1 of 3
(4,062 Views)

Hello BBANACKI!

 

The MS script documentation describes the second parameter as a long value and it will be converted to a long if it is not!

 

IMHO it is not a god idea to mixup VBS and DIAdem Date/Time functions. You can do what you want verry easy with pure DIAdem functions. The code will demonstrate this:Option Explicit
 
Dim
MuteStartTime
Dim MuteDurTime
Dim MuteStopTime
 
' preset variables
MuteStartTime = CurrDateTimeReal
MuteDurTime =
0.3 '!!! no string!
 
' DIAdem Date/Time is a real with 1s accurancy
MuteStopTime = MuteStartTime + MuteDurTime
 
' show result
MsgBox "Start " & RTT(MuteStartTime) & " + (Duration " & MuteDurTime & " Sec) = (Stop " & RTT(MuteStopTime)&""

 

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 3
(4,058 Views)

Thank you,

 

Problem solved

BBANACKI
0 Kudos
Message 3 of 3
(4,036 Views)