PHPackages                             simbiat/sand-clock - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. simbiat/sand-clock

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

simbiat/sand-clock
==================

Collection of functions to present time-related objects

2.4.1+20250417(1y ago)061[1 issues](https://github.com/Simbiat/sand-clock/issues)2AGPL-3.0-or-laterPHPPHP ^8.4

Since Jan 5Pushed 2w ago1 watchersCompare

[ Source](https://github.com/Simbiat/sand-clock)[ Packagist](https://packagist.org/packages/simbiat/sand-clock)[ Docs](https://github.com/Simbiat/cute-bytes)[ RSS](/packages/simbiat-sand-clock/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)DependenciesVersions (17)Used By (2)

SandClock
=========

[](#sandclock)

Set of functions for working with date/time.

How to use
----------

[](#how-to-use)

### Time Formatting

[](#time-formatting)

```
echo \Simbiat\SandClock::format(1234567890);
```

will output `2009-02-13 23:31:30.000000`

You can format to your liking

```
echo \Simbiat\SandClock::format(1234567890, 'H:i');
```

to get `23:31`

### Seconds to time units left

[](#seconds-to-time-units-left)

```
echo \Simbiat\SandClock::seconds('31536050000829051');
```

will output `1 aeon 1 millennium 5 centuries 8 decades 5 years 6 months 1 week 1 day 7 hours 10 minutes 52 seconds`

You can output the same in 'short' format (without text), for example

```
echo \Simbiat\SandClock::seconds('31536050000829051', false);
```

will output `1:1:5:8:5:6:1:1:7:10:52`

This function is multilingual and at the moment supports 8 languages: Deutsch (de), English (en), Spanish (es), French (fr), Italian (it), Japanese (jp), Russian (ru), Finnish (fi). You can switch it like this:

```
echo \Simbiat\SandClock::seconds('31536050000829051', true, 'jp');
```

will output `1 ion 1 sennenki 5 seiki 8 tōnen 5 toshi 6 tsuki 1 shū 1 hi 7 jikan 10 bun 52 byō`

You can also pass `iso: true` in order to generate the output compliant with ISO 8601 duration format like `P51Y8M0W4DT8H20M31S`

### Timezone conversion

[](#timezone-conversion)

If you want to convert timezone of a timestamp presented as integer, string, `\DateTime` or `\DateTimeImmutable` you can make a call like this:

```
\Simbiat\SandClock::convertTimezone('now', 'Europe/Helsinki', 'UTC')
```

This will return a respective `\DateTime` object, which you can then manipulate further. If you originally provide a `\DateTime` or `\DateTimeImmutable` object, you can use `null` for `$from` (2nd argument), since it will not be used in this case (empty string will throw an exception).

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance75

Regular maintenance activity

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~153 days

Recently: every ~85 days

Total

16

Last Release

391d ago

Major Versions

1.1.0+20200905 → 2.0.0+202103102021-03-10

PHP version history (5 changes)1.0.0+20190105PHP &gt;=5.6.0

1.1.0+20200905PHP &gt;=7.4.0

2.0.0+20210310PHP ^8

2.3.1+20240407PHP ^8.3

2.4.1+20250417PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6022665?v=4)[Dmitrii Kustov](/maintainers/Simbiat)[@Simbiat](https://github.com/Simbiat)

---

Top Contributors

[![Simbiat](https://avatars.githubusercontent.com/u/6022665?v=4)](https://github.com/Simbiat "Simbiat (3 commits)")

---

Tags

clockdatetimetimedatesand

### Embed Badge

![Health badge](/badges/simbiat-sand-clock/health.svg)

```
[![Health](https://phpackages.com/badges/simbiat-sand-clock/health.svg)](https://phpackages.com/packages/simbiat-sand-clock)
```

###  Alternatives

[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[brick/date-time

Date and time library

3623.3M61](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

2079.7M16](/packages/aeon-php-calendar)[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)[kartik-v/php-date-formatter

A Javascript datetime formatting and manipulation library using PHP date-time formats.

461.5M3](/packages/kartik-v-php-date-formatter)[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14282.3k](/packages/dater-dater)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
