Check if the Field is a Time Value

Last updated on Jun 30, 2023
Definition: isTime(fieldname: str) → bool
Description: Checks if a specific field is of time data type. The return value can be further used to transform the data. For example, calculating the work hours for employees.
Parameters: fieldname: The name of the field whose value is to be checked.
Returns: True, if the specified field’s value is of type, time.
False, for null and other data type values.

The following script checks if the specified property is of type, time:

from io.hevo.api import Event

def transform(event):
    <existing_properties> = event.getProperties()

    <boolean_value_type> = event.isTime('<property_name>')

    return event

Sample Transformation

The following script checks if the Session Started property is of time data type. The isTime property displays the return value of the method:

from io.hevo.api import Event

def transform(event):
    properties = event.getProperties()

    # Set a property to the return value of the method
    properties['isTime'] = event.isTime('Session Started')

    return event

Sample Output

The Transformation sets the isTime property to true, as Session Started is a time value.

Is a Time Value



Revision History

Refer to the following table for the list of key updates made to this page:

Date Release Description of Change
Feb-14-2023 NA New document.

Tell us what went wrong