Timestamp
This article explains what the timestamp field is and how to configure it.
A timestamp field in the Page Builder.
The timestamp field allows content writers to select a date and time.
The timestamp is saved in YYYY-MM-DDTHH:MM:SS+0000
format, like 2025-10-10T18:08:27+0000
. The timestamp is always UTC (+0
offset).
Timestamp field values can be formatted and displayed like any JavaScript date using the asDate()
helper from @prismicio/client
.
import { asDate } from "@prismicio/client";
const timestamp = asDate(slice.primary.release_timestamp);
<span>{timestamp?.toLocaleDateString("en-US")}</span>;
Add a timestamp field to a content model
Open Slice Machine
In your Prismic project, start Slice Machine to begin editing content models.
npx start-slicemachine --open
Add a timestamp field
In Slice Machine, navigate to the slice, page type, or custom type you want to modify. Add a timestamp field.
The label determines the label shown to content writers in the Page Builder. Use an easily understood name.
The API ID determines the property name in the Content API. Use a short, snake-cased name.
Use timestamp fields
Timestamp fields can be used anywhere a timestamp is needed. It is often helpful to first convert the timestamp to a JavaScript Date
object using asDate
from @prismicio/client
.
import { asDate } from "@prismicio/client";
function Slice() {
const timestamp = asDate(slice.primary.release_timestamp);
return <span>{timestamp?.toLocaleDateString("en-US")}</span>;
}
Check if a timestamp field has a value
Use isFilled.timestamp()
from @prismicio/client
to check if a timestamp field has a value.
import { isFilled } from "@prismicio/client";
if (isFilled.timestamp(slice.primary.my_timestamp_field)) {
// Do something if `my_timestamp_field` has a value.
}
Learn more about isFilled
API response
Here is what a timestamp field looks like from the Content API:
{
"example_timestamp": "2030-01-31:05:00:00+0000"
}