getdkan / pdlt
PHP Date Language Tool
Installs: 74 899
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.4
Requires (Dev)
- drupal/coder: ^8.3.14
- phpunit/phpunit: ^9.6
- rector/rector: ^0.15.17
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2024-12-12 20:42:51 UTC
README
PHP Date Language Tool
A simple parser generator for reading, processing, or translating regular date language formats.
Usage
To convert a Strptime to MySQL date format:
<?php use PDLT\CompilationMap\MySQL as MySQLCompilationMap; use PDLT\Compiler; use PDLT\Converter; use PDLT\Grammar\Strptime as StrptimeGrammar; use PDLT\Parser; // Build Strptime to MySQL date format converter using Strptime date format // parser and MySQL date format Compiler. $strptime_parser = new Parser(new StrptimeGrammar()); $mysql_compiler = new Compiler(new MySQLCompilationMap()); $converter = new Converter($strptime_parser, $mysql_compiler); // Convert a Strptime date format. echo $converter->convert('%-m/%-d/%y'); // Output: "%c/%e/%y".