DateToTimeStamp

Converts a date to timestamp.

python · Rubrik Security Cloud

Details

IDDateToTimeStamp
Languagepython
From Version6.0.0
Docker Imagedemisto/python3:3.12.8.3296088
Tagstransformer date

README

Converts a date to timestamp.

Script Data


Name Description
Script Type python3
Tags transformer, date

Inputs


Argument Name Description
value Date to convert

Outputs


There are no outputs for this script.

import dateparser
import demistomock as demisto  # noqa: F401


def date_to_time_stamp(date: str) -> int:
    date_obj = dateparser.parse(date)
    return int(date_obj.timestamp())  # type: ignore


def main():
    args = demisto.args()
    date_value = str(args["value"])
    demisto.results(date_to_time_stamp(date_value))


# python2 uses __builtin__ python3 uses builtins
if __name__ == "__builtin__" or __name__ == "builtins":
    main()