valorin/timeparser

Simple PHP class for parsing time values entered by users in a wide range of formats.

v1.0.1 2014-10-18 03:56 UTC

README

Simple PHP class for parsing time values entered by users in a wide range of formats.

Installation

Install with composer:

composer require valorin/timeparser

Usage

Add a use namespace declaration to your class:

use Valorin\TimeParser\TimeParser;

Set the required output format, and run the ::parse() function:

TimeParser::setFormat(TimeParser::FORMAT24);
$time = TimeParser::parse("09:32 am");