Date

Format a date

Returns formatted date

<time class="c-date" data-date="2020-01-01T17:25:43" datetime="2020-01-01T17:25:43" data-uid="68cc9710e2ed5">Wed 01 Jan 2020 </time>
@date([
    'action' => 'formatDate',
    'timestamp' => '2020-01-01 17:25:43'
])
@enddate

Time Since

Returns time since a specified date

<time class="c-date" data-date="2020-01-01T17:25:43" datetime="2020-01-01T17:25:43" data-tooltip="Wed 01 Jan 2020" data-uid="68cc9710e2f91">5 year ago</time>
@date([
    'action' => 'timesince',
    'timestamp' => '2020-01-01 17:25:43'
])
@enddate

Time Since [With translations]

Returns time since a specified date

<div>
      <time class="c-date" data-date="2020-01-01T17:25:43" datetime="2020-01-01T17:25:43" data-tooltip="Wed 01 Jan 2020" data-uid="68cc9710e3065">5 år ago</time>


</div>

<div>
      <time class="c-date" data-date="2025-09-18T23:34:40" datetime="2025-09-18T23:34:40" data-tooltip="Thu 18 Sep 2025" data-uid="68cc9710e30b1">just now </time>


</div>
<div>
  @date([
    'action' => 'timesince',
    'timestamp' => '2020-01-01 17:25:43',
    'labels' => [
      'year' => 'år',
      'month' => 'månad',
      'week' => 'vecka',
      'day' => 'dag',
      'hour' => 'timme',
      'minute' => 'minut',
      'second' => 'sekund'
    ],
    'labelsPlural' => [
      'year' => 'år',
      'month' => 'månader',
      'week' => 'veckor',
      'day' => 'dagar',
      'hour' => 'timmar',
      'minute' => 'minuter',
      'second' => 'sekund'
    ]
  ])
  @enddate
</div>

<div>
  @date([
    'action' => 'timesince',
    'timestamp' => date("Y-m-d H:i:s"), //'2020-01-01 17:25:43',
    'labels' => [
      'year' => 'år',
      'month' => 'månad',
      'week' => 'vecka',
      'day' => 'dag',
      'hour' => 'timme',
      'minute' => 'minut',
      'second' => 'sekund'
    ],
    'labelsPlural' => [
      'year' => 'år',
      'month' => 'månader',
      'week' => 'veckor',
      'day' => 'dagar',
      'hour' => 'timmar',
      'minute' => 'minuter',
      'second' => 'sekund'
    ]
  ])
  @enddate
</div>

Time Until

Returns time until a specified date

<time class="c-date" data-date="2025-09-23T00:00:00" datetime="2025-09-23T00:00:00" data-uid="68cc9710e315f">Tue 23 Sep 2025 </time>
@date([
    'action' => 'timeuntil',
    'timestamp' => date('Y-m-d', strtotime(' + 5 days'))
])
@enddate

Blade component parameters

Key Default value Type Available values Description
timestamp string - The date, in date string format or in unix timestamp format.
time_since false boolean - Will return the date since.
time_since_cap 6 months string - How long back to spell out time since
format D d M Y string - Present date's in this format. Default: D d M Y
region en_US string - Region for the date
timezone UTC string - Timezone for the date
action formatDate string - What to do with the inputted date: formatDate, timesince, timeuntil. Can be false to just output the timestamp.
labels [] array - Array containing translations valid keys: year, month, week, day, hour, minute, second
labelsPlural [] array - Array containing translations valid keys: year, month, week, day, hour, minute, second
timeSinceSuffix ago string - Suffix for the time since label
nowLabel just now string - What to show when the date is considered to be in the present
timeNowCap 60 integer - How many seconds back to show 'nowLabel'
id string - The DOM id of the component.
classList [] array - Array containing wrapping classes array
attributeList [] array - Array containing keys and values rendered as attributes
containerAware false boolean true/false Makes the component container aware. Appends modifiers --size--xs/sm/md/lg to the component.
Settings location: /var/www/webroot/ROOT/vendor/helsingborg-stad/component-library/source/php/Component/Date/date.json