Check if the Field is a Timestamp

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

The following script checks if the specified property is a timestamp:

from io.hevo.api import Event

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

    <boolean_value_type> = event.isTimestamp('<property_name>')
    
    return event

Sample Transformation

The following script checks if the Created property is a timestamp. The isTimestamp 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['isTimestamp'] = event.isTimestamp('Created')

    return event

Sample Output

The Transformation sets the isTimestamp property to true, as Created is a timestamp.

Is TimeStamp



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