当前位置:网站首页>Convert timestamp into milliseconds and format time in PHP
Convert timestamp into milliseconds and format time in PHP
2022-07-02 07:28:00 【Snow wind in the night sky】
Preface
Sometimes you need to operate on the timestamp , Like getting 13 Bit millisecond timestamps or formatted timestamps .
/** * Convert time to millisecond timestamp * @param int|string $time Time stamp | date * @return int */
function get_time($time)
{
if (is_numeric($time)) {
return (int) str_pad($time, 13, "0", STR_PAD_RIGHT);
} else {
return strtotime($time) * 1000;
}
}
/** * Timestamp to date * @param int|string $time Time stamp | date * @param string $format Formatting method * @return string */
function time_format($time, $format = 'Y-m-d')
{
if (is_numeric($time)) {
return date($format, substr($time, 0, 10));
} else {
return $time;
}
}
边栏推荐
- view的绘制机制(三)
- Changes in foreign currency bookkeeping and revaluation general ledger balance table (Part 2)
- Drawing mechanism of view (3)
- Using MATLAB to realize: power method, inverse power method (origin displacement)
- Oracle EBS database monitoring -zabbix+zabbix-agent2+orabbix
- CRP implementation methodology
- [introduction to information retrieval] Chapter 6 term weight and vector space model
- CSRF attack
- [model distillation] tinybert: distilling Bert for natural language understanding
- [introduction to information retrieval] Chapter 3 fault tolerant retrieval
猜你喜欢

Oracle EBS ADI development steps

SSM二手交易网站

中年人的认知科普

Using MATLAB to realize: Jacobi, Gauss Seidel iteration

Principle analysis of spark

Alpha Beta Pruning in Adversarial Search

传统目标检测笔记1__ Viola Jones
![[model distillation] tinybert: distilling Bert for natural language understanding](/img/c1/e1c1a3cf039c4df1b59ef4b4afbcb2.png)
[model distillation] tinybert: distilling Bert for natural language understanding

Oracle EBS数据库监控-Zabbix+zabbix-agent2+orabbix

Only the background of famous universities and factories can programmers have a way out? Netizen: two, big factory background is OK
随机推荐
Oracle EBS ADI development steps
使用Matlab实现:弦截法、二分法、CG法,求零点、解方程
ORACLE EBS中消息队列fnd_msg_pub、fnd_message在PL/SQL中的应用
Open failed: enoent (no such file or directory) / (operation not permitted)
ssm+mysql实现进销存系统
PointNet原理证明与理解
Changes in foreign currency bookkeeping and revaluation general ledger balance table (Part 2)
Module not found: Error: Can't resolve './$$_ gendir/app/app. module. ngfactory'
常见的机器学习相关评价指标
Oracle 11g uses ords+pljson to implement JSON_ Table effect
【MEDICAL】Attend to Medical Ontologies: Content Selection for Clinical Abstractive Summarization
Cognitive science popularization of middle-aged people
一份Slide两张表格带你快速了解目标检测
Oracle段顾问、怎么处理行链接行迁移、降低高水位
A slide with two tables will help you quickly understand the target detection
SSM学生成绩信息管理系统
CRP实施方法论
Explanation of suffix of Oracle EBS standard table
Jordan decomposition example of matrix
【Torch】最简洁logging使用指南