DataFunctions.ConvertTimeString Method

The ConvertTimeString method converts a string expression of a time value to a Date Variant, based on the specified locale. If successful, ConvertTimeString returns a Date Variant that contains the time; otherwise, Null. Additionally, if the string expression contains a date, ConvertTimeString returns Null.

Syntax

DataFunctions.ConvertTimeString(Time, Locale)

Parameters

Time
A string that specifies the time to convert.
Locale
Optional. This number specifies the locale to use to convert the string. For a list of valid locale values, see Hexadecimal Locale Identifiers. If this parameter is not specified, the value of the DataFunctions object’s Locale parameter is used.

Example

The following example converts the provided time value, and outputs the value to the page:

<% Time = DataFunctions.ConvertTimeString("3:30PM", &H0409) %>
<% =Hour(Time)%>
<% =Minute(Time)%>
<% =Second(Time)%>

The Time variable that is returned by ConvertTimeString in this example is actually a Date Variant in which the date part has been set to Null. Therefore, you should not use the VBScript Date function to attempt to extract the date from this value.

Related Topics


© 1997-1998 Microsoft Corporation. All rights reserved.