PHPackages                             pointybeard/helpers-functions-time - 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. pointybeard/helpers-functions-time

ActiveLibrary

pointybeard/helpers-functions-time
==================================

A collection of functions used to manipulate time values

1.1.0(5y ago)01.3k↑30.4%1MITPHPPHP &gt;=7.2

Since May 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/pointybeard/helpers-functions-time)[ Packagist](https://packagist.org/packages/pointybeard/helpers-functions-time)[ Docs](https://github.com/pointybeard/helpers-functions-time)[ RSS](/packages/pointybeard-helpers-functions-time/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (4)Used By (1)

PHP Helpers: Time Functions
===========================

[](#php-helpers-time-functions)

- Version: v1.1.0
- Date: April 17 2020
- [Release notes](https://github.com/pointybeard/helpers-functions-time/blob/master/CHANGELOG.md)
- [GitHub repository](https://github.com/pointybeard/helpers-functions-time)

A collection of functions used to manipulate time values

Installation
------------

[](#installation)

This library is installed via [Composer](http://getcomposer.org/). To install, use `composer require pointybeard/helpers-functions-time` or add `"pointybeard/helpers-functions-time": "~1.1.0"` to your `composer.json` file.

And run composer to update your dependencies:

```
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

```

### Requirements

[](#requirements)

This library makes use of the [pointybeard/helpers-exceptions-readabletrace](https://github.com/pointybeard/helpers-exceptions-readabletrace) package. It is installed automatically via composer.

To include all the [PHP Helpers](https://github.com/pointybeard/helpers) packages on your project, use `composer require pointybeard/helpers` or add `"pointybeard/helpers": "~1.2.0"` to your composer file.

Usage
-----

[](#usage)

This library is a collection convenience function for common tasks relating to time. They are included by the vendor autoloader automatically. The functions have a namespace of `pointybeard\Helpers\Functions\Time`

The following functions are provided:

- `human_readable_time(int $seconds, ?int $flags = FLAG_PAD_STRING | FLAG_INCLUDE_HOURS): string`
- `seconds_to_weeks($seconds): float`
- `seconds_to_days($seconds): float`
- `seconds_to_hours($seconds): float`
- `seconds_to_minutes($seconds): float`
- `weeks_to_seconds($weeks)`
- `days_to_seconds($days)`
- `hours_to_seconds($hours)`
- `minutes_to_seconds($minutes)`

Example usage:

```
