getdkan / pdlt
PHP日期语言工具
0.1.7
2024-06-12 19:32 UTC
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-09-12 20:04:20 UTC
README
PHP日期语言工具
这是一个简单的解析器生成器,用于读取、处理或转换常规日期语言格式。
用法
将 Strptime 转换为 MySQL 日期格式
<?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".