Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Latest commit

 

History

History
35 lines (23 loc) · 1.22 KB

timevalue-function.md

File metadata and controls

35 lines (23 loc) · 1.22 KB
title keywords f1_keywords ms.prod ms.assetid ms.date
TimeValue Function
vblr6.chm1009045
vblr6.chm1009045
office
02ce264a-aa6b-2249-da37-dee3522c2db7
06/08/2017

TimeValue Function

Returns a Variant ( Date ) containing the time. Syntax TimeValue(time) The required timeargument is normally astring expression representing a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive. However, time can also be anyexpression that represents a time in that range. If time containsNull, Null is returned. Remarks You can enter valid times using a 12-hour or 24-hour clock. For example, "2:24PM" and "14:24" are both valid time arguments. If the time argument contains date information, TimeValue doesn't return it. However, if time includes invalid date information, an error occurs.

Example

This example uses the TimeValue function to convert a string to a time. You can also use date literals to directly assign a time to a Variant or Date variable, for example, MyTime = #4:35:17 PM#.

Dim MyTime
MyTime = TimeValue("4:35:17 PM")    ' Return a time.