Siebel VB Language Reference > Methods Reference for Siebel VB > Date and Time Methods >

Convert String to Time Method


The Convert String to Time method converts a string to time. It returns a variant of date variable type that represents a time in one of the following ranges:

  • The time 0:00:00 through 23:59:59
  • The time 12:00:00 A.M. through 11:59:59 P.M.

For more information, see Variants.

Format

TimeValue(time)

The following table describes the arguments that you can use with this method.

Argument
Description

time

Any numeric or string expression that can evaluate to a date and time or time value.

Example

The following example writes a variable to a file according to a comparison of the last saved time and the current time. It dimensions the variables that it uses for the Convert String to Time method as double. It does this to make sure the calculations work correctly according to their values:

Sub Button_Click
   Dim tempfile As String
   Dim ftime As Variant
   Dim filetime as Double
   Dim curtime as Double
   Dim minutes as Double
   Dim acctno(100) as Integer
   Dim x, I
   tempfile = "C:\TEMP001"
   Open tempfile For Output As 1
   ftime = FileDateTime(tempfile)
   filetime = TimeValue(ftime)
   minutes = TimeValue("00:02:00")
   x = 1
   I = 1
   acctno(x) = 0
   Do
      curtime = TimeValue(Time)
      acctno(x) = 46
      If acctno(x) = 99 then
         For I = I to x-1
            Write #1, acctno(I)
         Next I
         Exit Do
      ElseIf filetime + minutes< = curtime then
         For I = I to x
            Write #1, acctno(I)
         Next I
      End If
      x = x + 1
   Loop
   Close #1
   x = 1
   msgtext = "You entered:" & Chr(10)
   Open tempfile for Input as #1
   Do While Eof(1) <> -1
      Input #1, acctno(x)
      msgtext = msgtext & Chr(10) & acctno(x)
      x = x + 1
   Loop
   Close #1
      Kill "C:\TEMP001"
End Sub

Siebel VB Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.