Cloud

time

The time data type in Redpanda SQL stores time values without any date information. It represents a specific time of day, independent of any time zone or date.

Format

The format for the time data type is as follows:

HH:MM:SS[.SSSSSS]
  • HH: One or two-digit hour (valid values from 00 to 23).

  • MM: One or two-digit minutes (valid values from 00 to 59).

  • SS: One or two-digit seconds (valid values from 00 to 59).

  • [.SSSSSS] : Optional fractional seconds, with up to six decimal places (microsecond precision).

Examples

Create a schedule table

The following example creates a table to manage employee schedules, containing their names and the time they are scheduled to start work. The start_time column uses the time data type.

CREATE TABLE employee_schedule (
    employee_name TEXT,
    start_time TIME
);

INSERT INTO employee_schedule (employee_name, start_time)
VALUES
('John Doe', '08:30:00'),
('Jane Smith', '09:00:00'),
('Michael Johnson', '10:15:00');

The table has been successfully created after executing the query:

COMPLETE
INSERT 0 3

View the employee schedule

To view all employee schedules in the employee_schedule table, use the SELECT statement.

SELECT * FROM employee_schedule;

The output displays the employee names and their corresponding scheduled start times:

  employee_name  |   start_time
-----------------+-----------------
 John Doe        | 08:30:00.000000
 Jane Smith      | 09:00:00.000000
 Michael Johnson | 10:15:00.000000
(3 rows)