epoch

Display current time in epoch

喜欢而已 提交于 2019-12-25 19:03:15
问题 I'm trying to display the current time in epoch, i'm not sure if this is correct, but i'm sure it's not since it's giving me an error: NSDate *currentDate = [NSDate date]; NSDate *epochDate = [NSDate dateWithTimeIntervalSince1970:currentDate]; Any idea of how to accomplish this? 回答1: NSString *epochTime = @"1347522689"; NSTimeInterval epochInterval = [epochTime longLongValue]; NSDate *epochNSDate = [[NSDate alloc] initWithTimeIntervalSince1970:epochInterval]; NSDateFormatter

Converting Date Timestamp to EPOCH via XSL

旧时模样 提交于 2019-12-25 09:47:55
问题 Apologies in advanced for the large block of code. I am able to output a timestamp with the code below. I would now like it to output in an EPOCH format. I cant seem to get anything to work looking at other submitted tickets. I am admittedly a bit of noob to XSL. I am confined to XSL1 Any help is appreciated. Thank you in advanced. <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt"

How to get the millisecond part while converting to date time from epoch using python

巧了我就是萌 提交于 2019-12-25 01:53:40
问题 I have a unix epoc time as 1571205166751 I want to convert it to date time in millisecond The desired result should be 2019-10-16 05:52:46:751 AM But using following code I am getting the result as 2019-10-16 05:52:46, not the millisecond part. import time time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(1571205166)) How to get the millisecond part while converting ? P.S. I want to covert epoch time, not any other format. 回答1: Use datetime.datetime.fromtimestamp epoch_time = 1571205166751 dt =

Moment different behaviour on different browsers

本小妞迷上赌 提交于 2019-12-24 13:23:01
问题 Let the following snippet: var dateJS = new Date("1950-09-09T23:00:00.000Z"); var dateMoment = moment("1950-09-09T23:00:00.000Z"); console.log("Javascript Epoch Time:", dateJS.valueOf()); console.log("Moment Epoch Time:", dateMoment.valueOf()); console.log("Is DST?", dateMoment.isDST()); <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.23.0/moment.min.js"></script> If you run it with some Firefox versions (such as Firefox 61.0.1) or with Microsoft Edge you get Is DST? true .

Python: get timezone based on DST for a timestamp

三世轮回 提交于 2019-12-24 05:31:57
问题 I wrote such a code to get timezone based on DST for an specific epoch time: def getTimeZoneFromEpoch(epoch) if time.daylight and time.gmtime(epoch).tm_isdst==1: return -time.altzone/3600.0 else: return -time.timezone/3600.0 But i'm not sure its correct, in fact at the moment i mistakes by 1 hour. Maybe i should swap altzone and timezone in this code, but its not what i understood from python's help (time module): timezone -- difference in seconds between UTC and local standard time altzone -

Python: get timezone based on DST for a timestamp

岁酱吖の 提交于 2019-12-24 05:31:20
问题 I wrote such a code to get timezone based on DST for an specific epoch time: def getTimeZoneFromEpoch(epoch) if time.daylight and time.gmtime(epoch).tm_isdst==1: return -time.altzone/3600.0 else: return -time.timezone/3600.0 But i'm not sure its correct, in fact at the moment i mistakes by 1 hour. Maybe i should swap altzone and timezone in this code, but its not what i understood from python's help (time module): timezone -- difference in seconds between UTC and local standard time altzone -

After loading UTC data, Dygraph axis dates are too long and won't adjust

感情迁移 提交于 2019-12-24 03:42:48
问题 I'm feeding Dygraph some nice unix epoch data, and it's showing the axes like this: I can't get it to be more terse and dynamically adjusted, after much fiddling. Here's my code: var graph = new Dygraph( document.getElementById('plot' + formNum), fileURL, // path to CSV file { legend:'always', title: "Activity of " + station + ".BK." + fullChannel + dateString, valueParser: function(x){ return x*1000; }, ticker: Dygraph.dateTicker } Why are they so long? How can I change them and still take

After loading UTC data, Dygraph axis dates are too long and won't adjust

ⅰ亾dé卋堺 提交于 2019-12-24 03:42:38
问题 I'm feeding Dygraph some nice unix epoch data, and it's showing the axes like this: I can't get it to be more terse and dynamically adjusted, after much fiddling. Here's my code: var graph = new Dygraph( document.getElementById('plot' + formNum), fileURL, // path to CSV file { legend:'always', title: "Activity of " + station + ".BK." + fullChannel + dateString, valueParser: function(x){ return x*1000; }, ticker: Dygraph.dateTicker } Why are they so long? How can I change them and still take

Azure Data Factory : querying _ts (epoch) field in CosmosDB source

孤街浪徒 提交于 2019-12-24 01:07:29
问题 I am trying to copy data from Azure CosmosDB into Azure SQL Database. In the Azure CosmosDB source, the query is as follows : select * from c where c.DefinitionTime >= '@{formatDateTime(pipeline().parameters.windowStart, 'yyyy-MM-ddTHH:mm:ssZ' )}' AND c.DefinitionTime < '@{formatDateTime(pipeline().parameters.windowEnd, 'yyyy-MM-ddTHH:mm:ssZ' )}' In CosmosDB, "DefinitionTime" is stored as a string. To the run the above query, I have to update "DefinitionTime" with range-indexing which is one

Java Converting date to epoch value produces false output

孤人 提交于 2019-12-23 18:57:36
问题 I am trying to convert the below date time string object into a unix epoch timestamp value. However, when i run the program i notice that it generates an epoch value of 1404461110000 which when i check on my ubuntu unix machine is Wed Aug 7 18:06:40 However in reality i am passing July 04 2014-07-04 04:05:10. I have a time zone of America/Toronto on my ubuntu machine but I don't think it should matter here ? Java code: long epoch = 0; String str = "2014-07-04 04:05:10"; // UTC DateFormat df =