utc

Converting string containing localtime into UTC in C

十年热恋 提交于 2019-12-01 05:26:10
I have a string containing a local date/time and I need to convert it to a time_t value (in UTC) - I've been trying this: char* date = "2009/09/01/00"; struct tm cal = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL}; strptime(date, "%Y/%m/%d/%H", &cal); time_t t = mktime(&cal); but the time_t value I get back is the value that I would expect if the string was being parsed as UTC not local time. Maybe I have misunderstood what strptime is supposed to do, but in my timezone (UK) on the 1st September we are using BST (ie UTC + 1 hour) so I would expect the value I end up with to be 1 hour ahead of UTC. Is

date / time conversion from user's local time to UTC on website

大城市里の小女人 提交于 2019-12-01 04:43:14
I'm currently adding an out of office like system to a website, where users will be able to mark their out of office dates and times such that they can provide another users's information to use as a backup while they are out. The problem I have, is converting the users's local time to UTC. I've seen other posts that address this issue by supplying UTC to the user, and having the client (js) convert the time to and from local time. I do, however, have access to a propriety system I can use to convert the date server-side based on the user's time-zone preference. My question is this: Should I

moment.js - UTC does not work as i expect it

≯℡__Kan透↙ 提交于 2019-12-01 03:55:35
testing in the node console: var moment = require('moment'); // create a new Date-Object var now = new Date(2013, 02, 28, 11, 11, 11); // create the native timestamp var native = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds()); // create the timestamp with moment var withMoment = moment.utc(now).valueOf() // it doesnt matter if i use moment(now).utc().valueOf() or moment().utc(now).valueOf() // native: 1364469071000 // withMoment: 1364465471000 native === withMoment // false!?!?! // this returns true!!! withMoment === now.getTime()

How do I get the correct modified datetime of a FAT32 file, regardless of timezone in .NET?

大城市里の小女人 提交于 2019-12-01 03:54:17
Please read this question fully and carefully before answering. The answer is not as simple as it might appear. I am writing a program that needs to keep track of the modified datetime of files, some of which are stored on an external FAT32 drive. The program is being run on various Windows 7 machines. The problem is the UTC modified datetime changes when the current UTC offset changes. Specifically, when we go from New Zealand Standard Time (UTC+12) to New Zealand Daylight Time (UTC+13) and back again. That is not a typo - the UTC modified datetime changes. It shouldn't, that is kind of the

pandas time shift from utc to local

折月煮酒 提交于 2019-12-01 03:24:32
问题 I am trying to convert utc time to local time. This is what I had before df_combined_features['timestamp'][1:10] 2013-01-24 2013-01-24 11:00:00 2013-04-25 2013-04-25 10:00:00 2013-07-25 2013-07-25 10:00:00 2013-10-24 2013-10-24 10:00:00 2014-01-30 2014-01-30 11:00:00 2014-04-24 2014-04-24 10:00:00 2014-07-24 2014-07-24 10:00:00 2014-10-23 2014-10-23 10:00:00 2015-01-27 2015-01-27 11:00:00 This is what I did df_combined_features['time_stamp'].tz_localize('US/Central')[1:10] 2013-01-24 00:00:00

Convert to UTC Timestamp

我的未来我决定 提交于 2019-12-01 02:57:54
//parses some string into that format. datetime1 = datetime.strptime(somestring, "%Y-%m-%dT%H:%M:%S") //gets the seconds from the above date. timestamp1 = time.mktime(datetime1.timetuple()) //adds milliseconds to the above seconds. timeInMillis = int(timestamp1) * 1000 How do I (at any point in that code) turn the date into UTC format? I've been ploughing through the API for what seems like a century and cannot find anything that I can get working. Can anyone help? It's currently turning it into Eastern time i believe (however I'm in GMT but want UTC). EDIT: I gave the answer to the guy with

d3 time scale x axis with unix timestamp

女生的网名这么多〃 提交于 2019-12-01 02:37:01
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, "low": 310}, {"time": 1387212140, "open": 213, "close": 253, "high": 289, "low": 213}]; data.forEach

MySQL default time format UTC or GMT?

旧城冷巷雨未停 提交于 2019-12-01 02:03:34
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 this http://www.forexpros.com/economic-calendar/ I'm working with drupal nodes Thanks in advance, Gobi

moment.js - UTC does not work as i expect it

依然范特西╮ 提交于 2019-12-01 00:27:28
问题 testing in the node console: var moment = require('moment'); // create a new Date-Object var now = new Date(2013, 02, 28, 11, 11, 11); // create the native timestamp var native = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds()); // create the timestamp with moment var withMoment = moment.utc(now).valueOf() // it doesnt matter if i use moment(now).utc().valueOf() or moment().utc(now).valueOf() // native: 1364469071000 // withMoment:

How do I get the correct modified datetime of a FAT32 file, regardless of timezone in .NET?

你离开我真会死。 提交于 2019-11-30 23:55:04
问题 Please read this question fully and carefully before answering. The answer is not as simple as it might appear. I am writing a program that needs to keep track of the modified datetime of files, some of which are stored on an external FAT32 drive. The program is being run on various Windows 7 machines. The problem is the UTC modified datetime changes when the current UTC offset changes. Specifically, when we go from New Zealand Standard Time (UTC+12) to New Zealand Daylight Time (UTC+13) and