gmt

Should I use DateTime.Now or DateTime.UtcNow in HttpCookie.Expires and HttpCachePolicy.SetExpires?

偶尔善良 提交于 2019-12-21 03:19:12
问题 Should I use DateTime.Now or DateTime.UtcNow in HttpCookie.Expires and HttpCachePolicy.SetExpires ? Cookies are sending 'GMT' time, but I don't know what happen if I send DateTime.Now.AddDays(3) if I would be in GMT+5. Same with Expires HTTP header (sec 14.21). What should I use? 回答1: It doesn't matter in this case. Internally, the first thing .SetExpires does is convert your supplied datetime into UTC, before setting it on the cookie. Bear in mind, as long as your datetime consumer uses the

JDBC Timestamp & Date GMT issues

若如初见. 提交于 2019-12-20 12:41:24
问题 I have a JDBC Date column, which if a i use getDate is get the ' date ' part only 02 Oct 2009 but if i use getTimestamp i get the full ' date ' 02 Oct 2009 13:56:78:890 . This is excatly what i want. However the 'date' returned by getTimestamp 'ignores' the GMT values, suppose date; 02 Oct 2009 13:56:78:890 , i end up getting 02 Oct 2009 15:56:78:890 My date was saved as a +2GMT date on the database but the application server is on GMT i.e 2hrs behind How can still get my date as is, 02 Oct

Get GMT String from current Date

丶灬走出姿态 提交于 2019-12-20 03:17:48
问题 I am able to get the output format that I need, but not the correct time. I need it in GMT (which is +4 hours) var dt = new Date(); var dt2 = dt.toString('yyyyMMddhhmmss'); Any ideas? The output looks like: 20120403031408 I am able to get the GMT in standard string format by doing: dt.toUTCString(); but im unable to convert it back to the yyyyMMddhhmmss string EDIT: I am using the date.js library 回答1: date.js 's toString(format) doesn't have an option to specify "UTC" when formatting dates.

PHP获取日期时间不对

大憨熊 提交于 2019-12-19 13:56:10
直入主题,通过date()函数获取时间后,你会发现小时时间不对,比现在的时间小8个小时,无论用H,还是用h都一样,这个是因为当前获取的是格林威治时间,与北京时间相差8小时。 解决方法如下: 1、修改php.ini配置文件 打开php.ini文件,一般在php配置根目录下,找到其中的 ;date.timezone,删掉前面的分号,并改为date timezone = PRC。保存,重启Apahce服务即可(有时用restart会有问题,先stop然后start就行了)。 2、加上date_default_timezone_set(timezone_identifier)函数 这个函数的意思是,设置当前时区,对时间进行初始化,在页头或获取时间语句前加上这句话。 例如: date_default_timezone_set(PRC); echo date("Y-m-d H-i-s"); 参数如下设置: date_default_timezone_set(PRC) –设置为北京时间,PRC代表中华人民共和国 date_default_timezone_set(‘Asia/Shanghai’) –设置为上海时间,大陆可用的还有‘Chongqi’(重庆)、‘Urumqi’(乌鲁木齐)同样可以的 港台地区可用:Asia/Macao ,Asia/Hong_Kong ,Asia/Taipei

How to get GMT date in yyyy-mm-dd hh:mm:ss in PHP

ぐ巨炮叔叔 提交于 2019-12-18 07:28:56
问题 I want to get the current date in yyyy-mm-dd hh:mm:ss format. I have tried: gmdate('yyyy-mm-dd hh:mm:ss \G\M\T', time()); Its returning a wierd date: 13131313-1111-2323 0707:1111:3131 回答1: You don't have to repeat those format identifiers . For yyyy you just need to have Y , etc. gmdate('Y-m-d h:i:s \G\M\T', time()); In fact you don't even need to give it a default time if you want current time gmdate('Y-m-d h:i:s \G\M\T'); // This is fine for your purpose Manual You can get that list of

UNIX timestamp always in GMT?

独自空忆成欢 提交于 2019-12-17 15:53:31
问题 UNIX timestamp always in GMT? I tried to run php function time() and when I tried to convert the unix timestamp from the time() function, the output is not similar to the computer time. Thank You 回答1: yep, UNIX timestamp represents how much seconds past from unix-time epoch in GMT+0 回答2: UNIX timestamp (A.K.A. Unix's epoch) means elapsed seconds since January 1st 1970 00:00:00 UTC (Universal Time). So , if you need the time in a specific TimeZone, you should convert it. Even though is

PHP daylight saving time detection

不想你离开。 提交于 2019-12-17 06:39:34
问题 I need to send an email to users based wherever in the world at 9:00 am local time. The server is in the UK. What I can do is set up a time difference between each user and the server's time, which would then perfectly work if DST didn't exist. Here's an example to illustrate it: John works in New York, -5 hours from the server (UK) time Richard works in London, UK, so 0 hour difference with the server. When the server goes from GMT to GMT +1 (BST) at 2:00am on a certain Sunday, this means

Difference between UTC and GMT Standard Time in .NET

我是研究僧i 提交于 2019-12-17 05:00:37
问题 In .NET, the following statements return different values: Response.Write( TimeZoneInfo.ConvertTime( DateTime.Parse("2010-07-01 5:30:00.000"), TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"), TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time")) ); // displays 7/1/2010 1:30:00 PM ..and this... Response.Write( TimeZoneInfo.ConvertTime( DateTime.Parse("2010-07-01 5:30:00.000"), TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"), TimeZoneInfo.FindSystemTimeZoneById(

Difference between UTC and GMT Standard Time in .NET

安稳与你 提交于 2019-12-17 05:00:10
问题 In .NET, the following statements return different values: Response.Write( TimeZoneInfo.ConvertTime( DateTime.Parse("2010-07-01 5:30:00.000"), TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"), TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time")) ); // displays 7/1/2010 1:30:00 PM ..and this... Response.Write( TimeZoneInfo.ConvertTime( DateTime.Parse("2010-07-01 5:30:00.000"), TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"), TimeZoneInfo.FindSystemTimeZoneById(

php date_default_timezone_set()设置时区

╄→гoц情女王★ 提交于 2019-12-16 15:46:28
<?php echo function_exists(date_default_timezone_set)."<br>";//在这他总是返回1,这函数是判断这里面的字符是不是一个定义了的函数名echo date('Y-m-d H:i:s')."<br>";//默认时区的时间 echo date_default_timezone_set("Etc/GMT")."<br>";//这是格林威治标准时间,得到的时间和默认时区是一样的echo date('Y-m-d H:i:s')."<br>"; echo date_default_timezone_set("Etc/GMT+8")."<br>";//这里比林威治标准时间慢8小时echo date('Y-m-d H:i:s')."<br>"; echo date_default_timezone_set("Etc/GMT-8")."<br>";//由上一个不能难想像,我们比那快8小时所以减8echo date('Y-m-d H:i:s')."<br>"; echo date_default_timezone_set('PRC')."<br>"; //设置中国时区echo date('Y-m-d H:i:s')."<br>";//中国标准时间?> //输出1 2009-05-15 02:20:42 //默认时区时间1 2009-05-15