# man > BSON::Timestamp

---
type: CommandReference
command: BSON::Timestamp
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference

- `bson_timestamp($seconds)` — Create a BSON timestamp with epoch seconds and default increment 0
- `bson_timestamp($seconds, $increment)` — Create a BSON timestamp with specified increment

## Name

BSON::Timestamp — BSON type wrapper for timestamps

## Synopsis

perl
use BSON::Types ':all';

bson_timestamp( $seconds );
bson_timestamp( $seconds, $increment );
This module provides a BSON type wrapper for timestamp values. It is generally not intended for end‑users, but is provided for backwards compatibility.

## Attributes

- `seconds` — Seconds since the Unix epoch; defaults to the current value of `time()`.
- `increment` — Integer to disambiguate timestamps within the same second; default 0.

## Methods

- `TO_JSON()` — If the `BSON_EXTJSON` option is true, returns a hashref compatible with MongoDB’s extended JSON format: `{"$timestamp" : { "t":<seconds>, "i":<increment> }}`. If `BSON_EXTJSON` is false, an error is thrown because this value cannot otherwise be represented in JSON.

## See Also

- [BSON::Types](http://localhost/phpMan.php/perldoc/BSON%3A%3ATypes/markdown) — provides `bson_timestamp`