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

如何用PHP格式“2010-12-20 06:32:48”获取当前时间?

Anyone knows how to do it?

What I know is time() but it's pure digits..

To obtain a formatted date/timestamp use the date() function

$dt = date('Y-m-d H:i:s');

As you've said, you can get the current timestamp via the time function. You can then pass this timestamp to PHP's date function. (It'll use the current time if no timestamp is provided.)

The specific format you're after is:

date('Y-m-d H:i:s');

近期文章

  • Php跑cronjobs
  • 寻找多语言代码片段html格式化程序(语法荧光笔)[关闭]
  • 如何显示24小时的报价
  • Wordpress以什么方式重写页面URL?
  • 在php中优先打印数组值
  • 使用PHP在服务器上执行应用程序(启用safe_mode)
  • 是否可以将pdf文件作为txt读取?
  • PHP:array('function'=>'theme_select_as_checkboxes')
  • 简单模型可以扩展Zend_Db_Row(本质上是Active Record)吗?
  • 在php中的数组中提取关联数组
  • PHP:需要仔细检查这个小代码中的错误
  • php smarty有没有办法记录谁登录该网站?
  • 使用HTML实体
  • PHP中的字符串问题
  • php语法查询
  • 使用php发送xml
  • 动态数组键添加
  • 显示一些字符的问题
  • 数据库更新时的警报消息
  • Eratosthenes算法的筛选

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华