> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# seconds_sub

> Subtracts a time interval from a date value.

Subtracts a time interval from a date value. The time interval is in seconds.

## Syntax

```Haskell theme={null}
DATETIME seconds_sub(DATETIME|DATE date, INT seconds);
```

## Parameters

`date`: the time expression. It must be of the DATETIME type.

`seconds`: the time interval you want to substract, in seconds. It must be of the INT type.

## Return value

Returns a value of the DATETIME type.

If the input value is of the DATE type, the hour, minute, and seconds parts are processed as `00:00:00`.

## Examples

```Plain Text theme={null}
select seconds_sub('2022-01-01 01:01:01', 2);
+---------------------------------------+
| seconds_sub('2022-01-01 01:01:01', 2) |
+---------------------------------------+
| 2022-01-01 01:00:59                   |
+---------------------------------------+

select seconds_sub('2022-01-01 01:01:01', -1);
+----------------------------------------+
| seconds_sub('2022-01-01 01:01:01', -1) |
+----------------------------------------+
| 2022-01-01 01:01:02                    |
+----------------------------------------+

select seconds_sub('2022-01-01', 1);
+------------------------------+
| seconds_sub('2022-01-01', 1) |
+------------------------------+
| 2021-12-31 23:59:59          |
+------------------------------+v
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.