我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何在PHP中获取特定的日期格式? [重复]

This question already has an answer here:

  • Convert one date format into another in PHP 15 answers

I need to get the date in a specific format in PHP.

The format is: "YYYY-MM-DD, JJ:NN:SS"

Example: "2018-04-01, 00:00:01"

I'm not sure how to get this in PHP without some hacks. How can I get this date format in PHP?

</div>

This way:

$date->format('Y-m-d, H:i:s');

Live demo. You can find more possible format placeholders in the documentation.

近期文章

  • ajax响应数据未定义总是[重复]
  • 尝试将表单值发送到数据库
  • 遇到mysqli时出现非数字值
  • PHP支付网关事务错误
  • 更改API数据输出的布局
  • 使用制表符和手风琴显示结果
  • Elasticsearch搜索结果过滤
  • 数据库值的Smarty计算
  • PHP。 任何人都可以用preg_match帮助我吗?
  • Laravel AJAX PUT不接收数据
  • 如何在php上搜索unicode字符?
  • HTML模式的问题,不显示
  • Symfony 4 - 显示模板问题css
  • 用C#解码PHP中的GZIP流
  • 使用星号的PHP / SQL SELECT语句
  • xampp / php - rsync ssh public passwordless
  • ChoiceType不映射到实体字段
  • 嵌套Json php for循环状态[0]问题
  • 将Base64从PHP转移到Javascript
  • 如何用curl发送数组和对象

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华