当前位置:网站首页>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;
}
}
边栏推荐
- Pratique et réflexion sur l'entrepôt de données hors ligne et le développement Bi
- Oracle 11g uses ords+pljson to implement JSON_ Table effect
- [introduction to information retrieval] Chapter 6 term weight and vector space model
- Using MATLAB to realize: power method, inverse power method (origin displacement)
- Analysis of MapReduce and yarn principles
- view的绘制机制(一)
- Oracle RMAN automatic recovery script (migration of production data to test)
- [introduction to information retrieval] Chapter 1 Boolean retrieval
- 【MEDICAL】Attend to Medical Ontologies: Content Selection for Clinical Abstractive Summarization
- [torch] the most concise logging User Guide
猜你喜欢

ORACLE 11G利用 ORDS+pljson来实现json_table 效果

SSM laboratory equipment management

使用MAME32K进行联机游戏

@Transitional step pit

SSM student achievement information management system
![[model distillation] tinybert: distilling Bert for natural language understanding](/img/c1/e1c1a3cf039c4df1b59ef4b4afbcb2.png)
[model distillation] tinybert: distilling Bert for natural language understanding

Oracle EBS ADI development steps

Message queue fnd in Oracle EBS_ msg_ pub、fnd_ Application of message in pl/sql

中年人的认知科普

Sparksql data skew
随机推荐
@Transational踩坑
点云数据理解(PointNet实现第3步)
ORACLE APEX 21.2安裝及一鍵部署
Jordan decomposition example of matrix
使用Matlab实现:弦截法、二分法、CG法,求零点、解方程
Data warehouse model fact table model design
Illustration of etcd access in kubernetes
架构设计三原则
【BERT,GPT+KG调研】Pretrain model融合knowledge的论文集锦
Oracle segment advisor, how to deal with row link row migration, reduce high water level
Error in running test pyspark in idea2020
生成模型与判别模型的区别与理解
Oracle EBS ADI development steps
[torch] the most concise logging User Guide
CONDA creates, replicates, and shares virtual environments
Huawei machine test questions
【模型蒸馏】TinyBERT: Distilling BERT for Natural Language Understanding
ssm超市订单管理系统
使用Matlab实现:Jacobi、Gauss-Seidel迭代
Optimization method: meaning of common mathematical symbols