beginner4 min read

Date & DateTime Fields

How date and datetime fields work, when to use each, and common patterns for scheduling and event dates.

Date vs. datetime

Date

Stores a calendar date without a specific time: "March 15, 2025". Use for:

  • Blog publish dates.
  • Event dates (all-day events).
  • Employee start dates.
  • Report periods.

DateTime

Stores a date with a specific time: "March 15, 2025 at 2:00 PM". Use for:

  • Webinar start times.
  • Workshop schedules.
  • Appointment slots.
  • Any content where the time of day matters.

When to use which

Use date when:

  • The time of day does not matter.
  • You are tracking when something was published or created.
  • You want simpler data entry (no time picker).

Use datetime when:

  • Events start at specific times.
  • You need to display "Starts at 2:00 PM EST".
  • You are building calendars or schedules.

Common patterns

Publish date

Every blog post and news article needs a publish date. Use a date field, not datetime. Set the default to today for convenience.

Event start and end

Use two separate fields:

  • Start date (date or datetime)
  • End date (date or datetime)

This handles multi-day events ("March 15-17") and timed events ("2:00 PM - 4:00 PM").

Scheduling content

Some CMS platforms support scheduled publishing based on a date field. Set a future publish date and the item goes live automatically.

Date ranges

For items with start and end dates (job postings, promotions, campaigns), use two date fields. Your front end can filter to show only currently active items.

Timezone considerations

DateTimes stored in a CMS are typically in UTC. When displaying to users:

  • Convert to the user's local timezone, or
  • Display in a fixed timezone with a label: "2:00 PM EST".

For events with a physical location, display the event's local timezone. For virtual events, consider showing multiple timezones.

Sorting and filtering

Dates are the most natural sort field:

  • Blog posts: newest first (date descending).
  • Events: soonest first (date ascending) for upcoming, newest first for past.
  • Job postings: newest first.

Filter patterns:

  • Show items where date is in the future (upcoming events).
  • Show items where date is in the past (archive).
  • Show items within a date range (this month, this quarter).

Tips

  1. Always use a date type — never store dates as text ("March 15, 2025"). Text dates cannot be sorted or filtered.
  2. Date for blogs, datetime for events — this is the rule of thumb. Blogs do not need times; events often do.
  3. Default to today — set the default value for publish dates to today's date. Reduces manual entry.
  4. Two fields for ranges — do not try to store "March 15-17" as text. Use separate start and end date fields.
  5. Consider "no date" state — make date fields optional for draft content that does not have a publish date yet.
fielddatedatetimeschedulingevents

Ready to build?

Ready to build your CMS?

Trellis architects content structures that scale. Start for free — no credit card required.

Start for free