# Get the current timestamp in seconds

Convert a date-time to whole Unix seconds.

Canonical: https://1loc.dev/date-time/get-the-current-timestamp-in-seconds/
Version: 1.0.0
Runtime: JavaScript · Node.js 22 / modern browsers
Verification: Local fixtures; no external services
Updated: 2026-10-28

## Implementation

```javascript
function unixSeconds(now) { return Math.floor(Date.parse(now) / 1000); }
```

## Input

```json
"2026-10-28T14:00:00Z"
```

## Expected output

```json
1793196000
```

## Edge case

Input:
```json
"1970-01-01T00:00:00.999Z"
```
Output:
```json
0
```

## Limits

- now is an input so the result is testable; pass new Date().toISOString(), or use Math.floor(Date.now() / 1000).
- Oveyon’s x-oveyon-timestamp webhook header is in these units: compare it with the current value to reject stale deliveries, as the signature lab shows.

The lab validates types and size before calling this function. Add equivalent validation at your own trust boundary.

## Source and license

Original: https://github.com/phuocng/1loc/blob/14b481cf60dff1620ab1bb99a43b1f68068cdd9b/contents/get-the-current-timestamp-in-seconds.mdx
Author: Nguyen Huu Phuoc and original contributors
Contributors: See original repository history
Source commit: 14b481cf60dff1620ab1bb99a43b1f68068cdd9b
Copyright (c) 2020 phuoc-ng
License: MIT — https://1loc.dev/licenses/
Maintainer: Oveyon
Modifications: Takes the current time as an input so the result is reproducible. Original MDX retained as inert source evidence.
