xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_IsDateTime()

Tests if the value returned by an expression is a DateTime value.

Syntax

HB_IsDateTime( <expression> ) --> lIsDateTime

Arguments

<expression>
This is an expression of any data type.

Return

The function returns .T. (true) if the value returned by <expression> is a DateTime value, otherwise .F. (false) is returned.

Description

Function HB_IsDateTime() is used to test if a variable contains a DateTime value or if the result of an expression is a DateTime value. The function is the only way to distinguish a DateTime value from a Date value, since Valtype(<expression>) yields "D" for both, Date and DateTime.

Info

See also:HB_IsArray(), HB_IsBlock(), HB_IsByRef(), HB_IsDate(), HB_IsHash(), HB_IsLogical(), HB_IsMemo(), HB_IsNIL(), HB_IsNull(), HB_IsNumeric(), HB_IsObject(), HB_IsPointer(), HB_IsString(), Type(), Valtype()
Category: Debug functions , Logical functions , xHarbour extensions
Source:rtl\dateshb.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates how to ditingush Date from DateTime values

   PROCEDURE Main
      LOCAL dDate     := DateTime()
      LOCAL dDateTime := Date()

      ? dDate                       // result: 04/27/07 13:21:26.00
      ? dDateTime                   // result: 04/27/07

      ? Valtype( dDate )            // result: D
      ? Valtype( dDateTime )        // result: D

      ? HB_IsDate( dDate )          // result: .T.
      ? HB_IsDate( dDateTime )      // result: .T.

      ? HB_IsDateTime( dDate )      // result: .T.
      ? HB_IsDateTime( dDateTime )  // result: .F.
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe