id: org.apache.streampipes.processors.transformation.jvm.datetime title: Datetime From String sidebar_label: Datetime From String


Overview

The “Datetime From String” processor is a handy tool that helps convert human-readable datetime information into a format that machines can understand. This is particularly useful when dealing with data that includes dates and times.

Why Use This Processor?

In the context of event streams, you may encounter dates and times formatted for human readability but not necessarily optimized for computer processing. The “Datetime From String” processor addresses this by facilitating the conversion of human-readable datetime information within your continuous stream of events.


How It Works

When you input a data stream into this processor containing a datetime in a specific format (such as “2023-11-24 15:30: 00”), it undergoes a transformation. The processor converts it into a computer-friendly format called a ZonedDateTime object.

Example

Let‘s say you have an event stream with a property containing values like “2023-11-24 15:30:00” and you want to make sure your computer understands it. You can use this processor to convert it into a format that’s machine-friendly.


Getting Started

To use this processor, you need one thing in your data:

  1. Datetime String: This is the name of the event property that contains the human-readable datetime string, like “2023-11-24 15:30:00”.

Configuration

The only thing you need to configure is the time zone.

  1. Time Zone: Specify the time zone that applies to your datetime if it doesn't already have this information.This ensures that the processor understands the context of your datetime.

Output

After the conversion happens, the processor adds a new piece of information to your data stream:

  • timestringInMillis: This is the transformed datetime in a format that computers can easily work with (UNIX timestamp in milliseconds).
  • timeZone: The name of the timezone the dateTime value refers to. Can be used to reconstitute the actual time.