utc

convert to UTC without changing php timezone settings

∥☆過路亽.° 提交于 2019-11-30 22:59:46
How can I convert the time zone of a date string in php without changing the default time zone. I want to convert it locally to display only. The php time zone settting should not be modified. EDIT: My source time is a UTC string, I want to convert it to a different format, retaining the time zone as UTC, but php is converting it to local timezone. The code I used was: date('Y-m-d H:i::s',strtotime($time_str)); How do I retain timezone? $src_tz = new DateTimeZone('America/Chicago'); $dest_tz = new DateTimeZone('America/New_York'); $dt = new DateTime("2000-01-01 12:00:00", $src_tz); $dt-

d3 time scale x axis with unix timestamp

别说谁变了你拦得住时间么 提交于 2019-11-30 22:15:13
问题 Having trouble formatting the x-axis of this time-series chart using d3 js. Here is a working example: http://tributary.io/inlet/7798421 The issue: I can only see 1 date (label) on my x-axis, regardless of total # of ticks specified. How can I display the time on x-axis with 4-6 ticks? EDIT: Solution below thanks to Lars. Here is my time in UTC: var data = [ {"time": 1387212120, "open": 368, "close": 275, "high": 380, "low": 158}, {"time": 1387212130, "open": 330, "close": 350, "high": 389,

JDBC/MySQL: Save timestamp always using UTC

喜欢而已 提交于 2019-11-30 22:01:48
I would like to save a timestamp to the database without being converted to the local timezone by the jdbc driver. Currently only MySQL and PostgreSQL are important for me but i would appreciate if there is a database independent solution. Example: // i want that to be saved as 1970-01-01 00:00:00 TimeStamp ts = new java.sql.Timestamp(0); // gets transformed to local time by jdbc driver (in my case to 1970-01-01 01:00:00) st.setTimestamp(0, new java.sql.Timestamp(0)); // only works using postgres (mysql connector seems to ignore the calendar) // postgres => 1970-01-01 00:00:00 // mysql => 1970

CentOS7--配置时间和日期

北慕城南 提交于 2019-11-30 21:41:09
CentOS7提供三个命令行工具,可用于配置和显示有关系统日期和时间的信息。 timedatectl: Linux 7中的新增功能,也是systemd其中的一部分。 date:系统时钟,也成为软件时钟,一旦系统启动并且系统时钟被初始化,系统时钟就完全独立硬件时钟。 hwclock: real-time clock ( RTC )通常被称为 硬件时钟 ,(在系统集成电路板上),即使在机器关闭时也能正常工作。实时时钟可以使用UTC( Universal Time )或本地时间,建议使用UTC。 使用 timedatectl 命令 显示当前日期和时间: 1 timedatectl 1 2 3 4 5 6 7 8 9 [root@zydev ~] # timedatectl Local time : Mon 2017-11-06 01:22:46 CST #中部标准时间,UTC+8 Universal time : Sun 2017-11-05 17:22:46 UTC RTC time : Sun 2017-11-05 17:22:46 Time zone: Asia /Shanghai (CST, +0800) NTP enabled: no NTP synchronized: no RTC in local TZ: no DST active: n /a

SQL Server: Convert Between UTC and Local Time Precisely

早过忘川 提交于 2019-11-30 21:29:05
I have a few columns in an SQL server 2008 R2 database that i need to convert from local time (the time zone the sql server is in) to UTC. I have seen quite a few similar questions on StackOverflow, but the answers all fail to work correctly with daylight saving time, they only take into account the current difference and offset the date. I could not find any way at all doing this using T-SQL alone. I solved it using SQL CLR: public static class DateTimeFunctions { [SqlFunction(IsDeterministic = true, IsPrecise = true)] public static DateTime? ToLocalTime(DateTime? dateTime) { if (dateTime ==

MySQL default time format UTC or GMT?

不羁的心 提交于 2019-11-30 20:54:19
问题 Hi I'm so confused with this UTC and GMT I'm inserting in MySQL table as ex column "event_date" like "2010-07-01 23:50:00" (datetime) my client asking an option in front end as GMT +1 GMT +2 GMT -1 GMT -2 ...etc if I select any option GMT +2 the event_date will filter/list according to the GMT +2. I have no idea how to proceed and after googling I found this CONVERT_TZ( `field_eventdate_value` , '+00:00', '+10:00' ) and whether it works well and my client gave me a sample URL to check like

idea关于连接mysql数据库异常解决的方法

你。 提交于 2019-11-30 19:36:33
?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC    idea编辑器是一个非常常用的软件,它不仅可以编写代码还是给数据库作为图形界面。别的数据不说,就mysql而言吧。你如果直接配置的话。 比如: 光是这样配置是不行的,就会出现如下的错误。 这时数据库是没有显示数据的,右下角也有报错信息。 说到这里你就会知道你的数据库在idea这里配置有问题了。那么你试试以下的两种方法,可以很好的解决这个问题 第一:    这Database这里添加一点配置: ?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC   加上就没问题了 还有第二种就是: 点击箭头所指的地方,然后在这边找一个serverTimezone 把它的值改为UTC 效果如下:    这样就可以在idea使用mysql数据库了。 如果本文章对你有所帮助,请帮我点个赞哦!! 来源: https://www.cnblogs.com

Get the GMT time given date and UTC offset in python

荒凉一梦 提交于 2019-11-30 18:32:26
问题 I have a date string of the following format '%Y%m%d%H%M%S' for example '19981024103115' and another string of the UTC local offset for example '+0100' What's the best way in python to convert it to the GMT time So the result will be '1998-10-24 09:31:15' 回答1: You could use dateutil for that: >>> from dateutil.parser import parse >>> dt = parse('19981024103115+0100') >>> dt datetime.datetime(1998, 10, 24, 10, 31, 15, tzinfo=tzoffset(None, 3600)) >>> dt.utctimetuple() time.struct_time(tm_year

SQL Server: Convert Between UTC and Local Time Precisely

 ̄綄美尐妖づ 提交于 2019-11-30 17:44:25
问题 I have a few columns in an SQL server 2008 R2 database that i need to convert from local time (the time zone the sql server is in) to UTC. I have seen quite a few similar questions on StackOverflow, but the answers all fail to work correctly with daylight saving time, they only take into account the current difference and offset the date. 回答1: I could not find any way at all doing this using T-SQL alone. I solved it using SQL CLR: public static class DateTimeFunctions { [SqlFunction

Using time zones in a PHP web application

*爱你&永不变心* 提交于 2019-11-30 14:14:28
I've been looking around for a few hours now about what's the best way to use timezones in a PHP/MySQL web application, finding a definitive answer is hard. From what I've learnt so far it is best to store everyones stuff in the database in UTC (correct me if I am wrong). When a user registers I will ask them for there timezone and then store that against there user. This would be in this format as a dropdown menu: <option value="Europe/London">(GMT) Greenwich Mean Time : London</option> The app I am building will allow users to set arrangements in the future with people (meetings), much like