### TimeValue

Basic and Crystal syntax.

The CTime and Time functions are equivalent to TimeValue. However, Time can only be used in Crystal syntax since it is a type name in Basic syntax.

##### Overloads

- TimeValue (number)
- TimeValue (string)
- TimeValue (dateTime)
- TimeValue (HH, MM, SS)

##### Arguments

TimeValue (number) | Returns a Time value given a number in units of 24 hours number can be fractional or negative as well.
TimeValue (string) | Returns a Time value that represents the time, given a String expression specifying a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive.
TimeValue (dateTime) | DateTime is a DateTime value.
TimeValue (hour, min, sec) | Hour is a whole number representing an hour of the day. Min is a whole number representing a minute. Sec is a whole number representing a second.

##### Returns

Time value.

##### Action

TimeValue (number) returns a Time value given a number in units of 24 hours. The number can be negative or fractional as well.

TimeValue (string) returns a Time value that represents the time, given a String expression specifying a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive.

TimeValue (dateTime) returns the time portion of a given DateTime value.

TimeValue (HH, MM, SS) returns a Time value given numeric arguments of the hour, minute and seconds.

##### Examples

The following examples are applicable to both Basic and Crystal syntax:

TimeValue (.2)
TimeValue (1.2)

Both return the same value 4:48:00 a.m.

`TimeValue (-.2)`

Returns 7:12:00 pm

`TimeValue ("Jan. 6, 1999 2:30pm")`

Returns 2:30:00 pm

`TimeValue (#Feb. 24, 1999 2:40pm#)`

Returns 2:40:00 pm

`TimeValue (18, 30, 30)`

Returns 6:30:30 pm

##### Comments

You can use the IsTime function to check if a string argument can be converted to a Time before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately. See alsoTimeSerial (hour, minute, second).

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com