Timestamp
Last updated

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 2026-05-22T11:41:07+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
Timestamp fields are added using the Type Builder, a tool for building by hand, or the Prismic CLI, a tool for AI agents.
Watch for changes
In your local website project, start the Prismic CLI’s
synccommand. The CLI will watch for changes in the Type Builder and pull them into your project.npx prismic sync --watchAdd a timestamp field
In the Type Builder, navigate to the slice, page type, or custom type you want to modify. Add a timestamp field and provide the following:
- Label: The label shown to content writers in the Page Builder. Use an easily understandable name.
- API ID: The property name in the Content API. Use a short, snake-cased name.
You can now close the Prismic CLI
synccommand or add your next field.
Add a timestamp field
Use the
prismic field add timestampcommand to add a timestamp field to a slice.npx prismic field add timestamp release_timestamp --to-slice MySliceUse
--to-typeto add the field to a page type or custom type instead.npx prismic field add timestamp release_timestamp --to-type page
Open Slice Machine
In your Prismic project, start Slice Machine to begin editing content models.
npx start-slicemachine --openAdd 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 understandable 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"
}