php中DateTime的format格式以及 TtoDatetime函数
Definition and Usage
The date() function formats a local time/date.
Syntaxdate(format,timestamp)
ParameterDescriptionformat Required. Specifies how to return the result:
- d - The day of the month (from 01 to 31)
- D - A textual representation of a day (three letters)
- j - The day of the month without leading zeros (1 to 31)
- l (lowercase 'L') - A full textual representation of a day
- N - The ISO-8601 numeric representation of a day (1 for Monday through 7 for Sunday)
- S - The English ordinal suffix for the day of the month (2 characters st, nd, rd or th. Works well with j)
- w - A numeric representation of the day (0 for Sunday through 6 for Saturday)
- z - The day of the year (from 0 through 365)
- W - The ISO-8601 week number of year (weeks starting on Monday)
- F - A full textual representation of a month (January through December)
- m - A numeric representation of a month (from 01 to 12)
- M - A short textual representation of a month (three letters)
- n - A numeric representation of a month, without leading zeros (1 to 12)
- t - The number of days in the given month
- L - Whether it's a leap year (1 if it is a leap year, 0 otherwise)
- o - The ISO-8601 year number
- Y - A four digit representation of a year
- y - A two digit representation of a year
- a - Lowercase am or pm
- A - Uppercase AM or PM
- B - Swatch Internet time (000 to 999)
- g - 12-hour format of an hour (1 to 12)
- G - 24-hour format of an hour (0 to 23)
- h - 12-hour format of an hour (01 to 12)
- H - 24-hour format of an hour (00 to 23)
- i - Minutes with leading zeros (00 to 59)
- s - Seconds, with leading zeros (00 to 59)
- e - The timezone identifier (Examples: UTC, Atlantic/Azores)
- I (capital i) - Whether the date is in daylights savings time (1 if Daylight Savings Time, 0 otherwise)
- O - Difference to Greenwich time (GMT) in hours (Example: +0100)
- T - Timezone setting of the PHP machine (Examples: EST, MDT)
- Z - Timezone offset in seconds. The offset west of UTC is negative, and the offset east of UTC is positive (-43200 to 43200)
- c - The ISO-8601 date (e.g. 2004-02-12T15:19:21+00:00)
- r - The RFC 2822 formatted date (e.g. Thu, 21 Dec 2000 16:01:07 +0200)
- U - The seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
timestampOptional.
example:
function TtoDatetime($text){
$myDatetimeStr=Date('Y',strtotime($text))."-".Date('m',strtotime($text))."-".Date('d',strtotime($text))." ".Date('H',strtotime($text)).":".Date('i',strtotime($text)).":".Date('s',strtotime($text));
return $myDatetimeStr;
}
echo $text;
echo TtoDatetime($text);
result:
"01/07/2012 13:44",2012-01-07 13:44:00
php中DateTime的format格式以及 TtoDatetime函数的更多相关文章
- sql查询中datetime显示的格式为yyyy-DD-mm
datetime数据库中保存的形式为2008/9/29 星期一 上午 12:00:00,希望界面显示2008-09-29,则可以用到以下sql语句. ),kgrq, ),),jhjgrq, ),'/' ...
- 解决Asp.net Mvc返回JsonResult中DateTime类型数据格式的问题
问题背景: 在使用asp.net mvc 结合jquery esayui做一个系统,但是在使用使用this.json方法直接返回一个json对象,在列表中显示时发现datetime类型的数据在转为字符 ...
- RMAN备份FORMAT格式中%的含义
使用格式串先看例子:Configure channel 1 device type disk format 'd:/backup/orcl/backup_%U';在configure 命令中经常使用格 ...
- C# WebAPI中DateTime类型字段在使用微软自带的方法转json格式后默认含T的解决办法
原文:C# WebAPI中DateTime类型字段在使用微软自带的方法转json格式后默认含T的解决办法 本人新手,在.Net中写WebAPI的时候,当接口返回的json数据含有日期时间类型的字段时, ...
- python中datetime模块
Python提供了多个内置模块用于操作日期时间,像calendar,time,datetime.time模块我在之前的文章已经有所介绍,它提供 的接口与C标准库time.h基本一致.相比于time模块 ...
- python中 datetime模块的详解(转载)
Python提供了多个内置模块用于操作日期时间,像calendar,time,datetime.time模块我在之前的文章已经有所介绍,它提供 的接口与C标准库time.h基本一致.相比于time模块 ...
- Python中datetime库的用法
datetime模块用于是date和time模块的合集,datetime有两个常量,MAXYEAR和MINYEAR,分别是9999和1. datetime模块定义了5个类,分别是 1.datetime ...
- SQL中CONVERT日期不同格式的转换用法
SQL中CONVERT日期不同格式的转换用法 格式: CONVERT(data_type,expression[,style]) 说明:此样式一般在时间类型(datetime,smalldatetim ...
- String.Format格式说明——复制于DotNet笔记
String.Format格式说明 C#格式化数值结果表 字符 说明 示例 输出 C 货币 string.Format("{0:C3}", 2) $2.000 D 十进制 st ...
随机推荐
- Java中的五种单例模式实现方法
[代码] Java中的五种单例模式实现方法 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2 ...
- redhat安装wine
在基于RedHat或Debian的系统上安装 Wine 1.7 原创:LCTT https://linux.cn/article-3723-1.html Wine,Linux上最流行也是最有力的软件, ...
- UVALive 2147 Push!!(队列实现DP)
就我的理解来说这个题,本质上是一个DP题,不应该说是搜索,因为我的做法是把表格中所有的数据都找到,使用队列暴力来遍历出所有状态,因为题目中的数据范围小,所有耗时也小. 首先分析箱子是一个被动物体,人是 ...
- 激活OFFICE2010时,提示choice.exe不是有效的win32程序
我在安装office2010破解版时,提示choice.exe不是有效的win32应用程序 删除choice.exe再激活,按提示找到目录删掉这个文件,需要设置显示隐藏文件夹
- 仿照微信的界面,即ViewPager+Fragment的结合使用
主布局文件: android:drawableTop="@drawable/weixin_bg"用的是状态选择器,所以要写4个状态选择器,图片的 <RelativeLayou ...
- cordova插件开发-1
这是初级编,实现了js调用Android代码 首先需要编写java代码: public class AppUpdate extends CordovaPlugin { @Override public ...
- Servlet程序开发-- Servlet生命周期
生命周期是一个程序的存在周期,受容器管理,所以容器决定生命周期. 生命周期包括 加载,初始化,服务,销毁,卸载 5个部分 加载:第一次使用的时候加载 初始化:init方法, 失败的话,直接卸载,如果成 ...
- android:分享 一个很强大的LOG开关---Log.isLoggable
标签:android分享 一个很强大的log开 1.API亮点: 此API可以实现不更换APK,在出问题的手机上就直接能抓到有效log,能提升不少工作效率. 2.API介绍 最近在解决短信问题时,看到 ...
- 文件夹添加 IIS 应用程序池用户权限
http://serverfault.com/questions/81165/how-to-assign-permissions-to-applicationpoolidentity-account ...
- Android 联网监控抓包工具的制作(tcpdump的使用)
最近做一个Android联网抓包的工具 自己在网上搜索了好久 发现还是没有头绪 于是考虑在linux层上下功夫 于是采用linux的tcpdump来实现了抓包的功能 用简单的话来定义tcpdump,就 ...