PHPackages                             hashbang/epoctools - 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. hashbang/epoctools

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

hashbang/epoctools
==================

Library to provide various epoc handling functions

v1.1.3(12y ago)023MITPHPPHP &gt;=5.0.0

Since Mar 21Pushed 12y ago1 watchersCompare

[ Source](https://github.com/hash-bang/EpocTools)[ Packagist](https://packagist.org/packages/hashbang/epoctools)[ Docs](https://github.com/hash-bang/EpocTools)[ RSS](/packages/hashbang-epoctools/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

EpocTools - PHP epoc manipulation
=================================

[](#epoctools---php-epoc-manipulation)

A simple library to provide various epoc handling functionality.

Installation
============

[](#installation)

Installing into CodeIgniter
---------------------------

[](#installing-into-codeigniter)

Download this repo and copy into your application directory.

Alternatively, install with [Composer](http://getcomposer.org).

Functions
=========

[](#functions)

`age` - Helper function for `humanize` that returns the age of something
------------------------------------------------------------------------

[](#age---helper-function-for-humanize-that-returns-the-age-of-something)

This function is used to calculate the age of an item relative to another time. See `humanize` for a full example list

```
$this->EpocTools = new EpocTools();
$this->EpocTools->Age(strtotime('2011-01-01'), strtotime('2011-01-02')) // Reutns '1 day'
$this->EpocTools->Age(strtotime('2011-01-01 22:00'), strtotime('2011-01-02 23:00')) // Reutns '1 day, 1 hour'

```

`date` - Return the time at midnight of an epoc
-----------------------------------------------

[](#date---return-the-time-at-midnight-of-an-epoc)

When given any epoc style date this function sets the time of that epoc to midnight precicely.

```
$this->EpocTools = new EpocTools();
$this->EpocTools->date(time()); // Returns the epoc at midnight today
$this->EpocTools->date(strtotime('2011-01-01 04:32:21')); // Returns midnight on 01/01/2011

```

`epocdateend` - Return the last second of a given epoc date
-----------------------------------------------------------

[](#epocdateend---return-the-last-second-of-a-given-epoc-date)

In contrast to `epocdate` this function returns the last possible second of a given date.

```
$this->EpocTools = new EpocTools();
$this->EpocTools->dateend(time()); // Returns the last possible second of todays date
$this->EpocTools->dateend(strtotime('2011-01-01 04:32:21')); // Returns 23:59:59 on 01/01/2011

```

`getstamp` - The inverse of `date()`
------------------------------------

[](#getstamp---the-inverse-of-date)

This function takes a given string and converts it into a date using the template provided. This is in contrast to the default PHP Date() function which does the opposit.

```
$this->EpocTools = new EpocTools();
$this->EpocTools->getstamp('d/m/Y H:M','02/07/1983 1035'); // Returns unix timestamp 425952900

```

`humanize` - Returns a sequence of seconds in human format
----------------------------------------------------------

[](#humanize---returns-a-sequence-of-seconds-in-human-format)

This function can be used to return how far an event occurs in the past or future relative to the current time

```
$this->EpocTools = new EpocTools();
$this->EpocTools->Humanize(time() - 60); // Returns '60 seconds ago'
$this->EpocTools->Humanize(time() - 5400); // Returns '1 hour, 30 minutes ago'
$this->EpocTools->Humanize(time() - 72576000); // Returns '2 weeks ago'

```

A vareity of options can be specified including how many time scales should be selected (i.e. how specific) for example '2 weeks, 1 hour' would have two blocks, '2 weeks, 1 hour, 38 minutes, 42 seconds' would have four.

`shorthand` - Return the number of seconds from a human readable time shorthand
-------------------------------------------------------------------------------

[](#shorthand---return-the-number-of-seconds-from-a-human-readable-time-shorthand)

This function returns the number of seconds determined from a shorthand time string.

```
$this->EpocTools = new EpocTools();
$this->EpocTools->Shorthand('1h') // Returns 3600 (1 hour - 60*60)
$this->EpocTools->Shorthand('1h30m') // Returns 5400 (1 hour 30 minutes - 60*60 + 30*60)
$this->EpocTools->Shorthand('2w') // Returns 72576000 (2 weeks - 7*24*60*60*60*2)

```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~13 days

Total

5

Last Release

4434d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8587289?v=4)[hashbang](/maintainers/hashbang)[@hashbang](https://github.com/hashbang)

---

Top Contributors

[![hash-bang](https://avatars.githubusercontent.com/u/624527?v=4)](https://github.com/hash-bang "hash-bang (9 commits)")

---

Tags

time

### Embed Badge

![Health badge](/badges/hashbang-epoctools/health.svg)

```
[![Health](https://phpackages.com/badges/hashbang-epoctools/health.svg)](https://phpackages.com/packages/hashbang-epoctools)
```

###  Alternatives

[symfony/clock

Decouples applications from the system clock

436205.7M378](/packages/symfony-clock)[knplabs/knp-time-bundle

Making your dates and durations look sensible and descriptive

6339.5M54](/packages/knplabs-knp-time-bundle)[league/period

Time range API for PHP

7335.8M23](/packages/league-period)[wapmorgan/morphos

A morphological solution for Russian and English language written completely in PHP. Provides classes to inflect personal names, geographical names, decline and pluralize nouns, generate cardinal and ordinal numerals, spell out money amounts and time.

8351.4M7](/packages/wapmorgan-morphos)[brick/date-time

Date and time library

3663.8M101](/packages/brick-date-time)[aeon-php/calendar

PHP type safe, immutable calendar library

20810.4M16](/packages/aeon-php-calendar)

PHPackages © 2026

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