Check if the Field is a Date
Definition: | isDate(fieldname: str ) → bool |
Description: | Checks if a specific field is of date data type. The return value can be further used to transform the data. For example, deleting data created before Jan 01, 2020. |
Parameters: | fieldname: The name of the field whose value is to be checked. |
Returns: | - True, if the specified field’s value is of type, date. - False, for null and other data type values, including datetime. |
The following script checks if the specified property is a date:
from io.hevo.api import Event
def transform(event):
<existing_properties> = event.getProperties()
<boolean_value_type> = event.isDate('<property_name>')
return event
Sample Transformation
The following script checks if the Created On
property is a date. The isDate
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['isDate'] = event.isDate('Created On')
return event
Sample Output
The Transformation sets the isDate
property to true, as Created On
is a date.
Last updated on Jun 30, 2023