epoch

Javascript Convert Date Time string to Epoch

[亡魂溺海] 提交于 2019-11-27 14:20:27
so I give up...been trying to do this all day; I have a string that supplies a date and time in the format dd/MM/yyyy hh:mm ( 04/12/2012 07:00 ). I need to turn that into an Epoch date so I can do some calculations upon it. I cannot modify the format in which the date time is sent to me. JavaScript or jQuery is fine. JavaScript dates are internally stored as milliseconds since epoch. You just need to convert it to a number, e.g. with the unary + operator, to get them. Or you can use the .getTime method . The harder will be parsing your date string. You likely will use a regex to extract the

How to convert epoch to datetime redshift?

早过忘川 提交于 2019-11-27 13:46:04
问题 I work in dbeaver. I have a table x. TABLE x has a column "timestamp" 1464800406459 1464800400452 1464800414056 1464800422854 1464800411797 The result I want: Wed, 01 Jun 2016 17:00:06.459 GMT Wed, 01 Jun 2016 17:00:00.452 GMT Wed, 01 Jun 2016 17:00:14.056 GMT Wed, 01 Jun 2016 17:00:22.854 GMT Wed, 01 Jun 2016 17:00:11.797 GMT I tried redshift query SELECT FROM_UNIXTIME(x.timestamp) as x_date_time FROM x but didn't work. Error occurred: Invalid operation: function from_unixtime(character

Convert a NSDate to milliseconds epoch time

感情迁移 提交于 2019-11-27 13:42:13
问题 I need to be able to convert a date to a time stamp, an epoch in milliseconds. All I see online are for converting milliseconds to NSDate and not the other way round. Any help out there? 回答1: NSTimeInterval is a double that already contains sub-second data after the decimal point. Depending what you need, your conversion could be a simple as multiplying by 1000. - (void)testDateFormat { NSDate *date = [NSDate date]; NSLog(@"Time: %f", floor([date timeIntervalSince1970] * 1000)); NSLog(@"Time:

Calculating Future Epoch Time in C#

╄→гoц情女王★ 提交于 2019-11-27 12:28:39
I was able to find example code to get the current timestamp in Linux Epoch (Seconds since Midnight Jan 1st 1970), however I am having trouble finding an example as to how to calculate what the Epoch will be in the future, say for example 10 minutes from now, so how can I calculate a future time in Linux Epoch? This extension method should do the job: private static double GetUnixEpoch(this DateTime dateTime) { var unixTime = dateTime.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); return unixTime.TotalSeconds; } And you can use it as such: var unixTime1 = DateTime.Now

PostgreSQL: how to convert from Unix epoch to date?

独自空忆成欢 提交于 2019-11-27 09:59:53
问题 The statement gives me the date and time. How could I modify the statement so that it returns only the date (and not the time)? SELECT to_timestamp( TRUNC( CAST( epoch_ms AS bigint ) / 1000 ) ); 回答1: /* Current time */ select now(); /* Epoch from current time; Epoch is number of seconds since 1970-01-01 00:00:00+00 */ select extract(epoch from now()); /* Get back time from epoch */ -- Option 1 - use to_timestamp function select to_timestamp( extract(epoch from now())); -- Option 2 - add

oracle convert unix epoch time to date

可紊 提交于 2019-11-27 09:08:34
The context is that there is an existing application in our product which generates and sends the EPOCH number to an existing oracle procedure & vice versa. It works in that procedure using something like this SELECT UTC_TO_DATE (1463533832) FROM DUAL SELECT date_to_utc(creation_date) FROM mytable When I tried these queries it does work for me as well with Oracle 10g server (and oracle sql developer 4.x if that matters). In the existing procedure the requirement was to save the value as date itself (time component was irrelevant), however in the new requirement I have to convert unix EPOCH

Get the number of days, weeks, and months, since Epoch in Java

China☆狼群 提交于 2019-11-27 09:01:32
I'm trying to get the number of days, weeks, months since Epoch in Java. The Java Calendar class offers things like calendar.get(GregorianCalendar.DAY_OF_YEAR), or Calendar.get(GregorianCalendar.WEEK_OF_YEAR), which is a good start but it doesn't do exactly what I need. Is there an elegant way to do this in Java? You can use the Joda Time library to do this pretty easily - I use it for anything time related other than using the standard Java Date and Calendar classes. Take a look at the example below using the library: MutableDateTime epoch = new MutableDateTime(); epoch.setDate(0); //Set to

Is it possible to set a git commit to have a timestamp prior to 1970?

a 夏天 提交于 2019-11-27 09:00:38
Unix timestamps are signed 32 bit integers (64 bit on some systems today, or so I understand). On some software products this allows you to use dates going back as far as 1903 or so. However, when I try the following: git commit -m "this is a test commit" --date="1960-04-07 18:00:00" I receive an "fatal: invalid date format" error. This isn't very practical (I'm not a time-traveler), but I've been wondering about using git for historical purposes. Can this be forced with a git plumbing command? On a related note: does git always use a 32 bit timestamp, or does this depend on the environment it

Convert epoch to date in sqlplus / Oracle

谁都会走 提交于 2019-11-27 08:56:07
I have the following table: SQL> desc recording Name Null? Type -------------------- -------- ------ CAPTUREID NOT NULL NUMBER(9) STARTDATE NOT NULL DATE ENDDATE DATE STATE NUMBER(1) ESTIMATEDENDTIME NUMBER(13) Here's a single line for this table: SQL> select * from recording where CAPTUREID=14760457; CAPTUREID STARTDATE ENDDATE STATE ESTIMATEDENDTIME ---------- ------------------- ------------------- ----- ---------------- 14760457 29/09/2010 08:50:01 29/09/2010 09:52:04 0 1285746720000 I'm pretty sure that this has been asked so many times before, but all the solutions I've found so far didn

String date into Epoch time

假装没事ソ 提交于 2019-11-27 08:53:57
问题 I am little bit confused in dates. I am currently working on the weather app and everything works fine .. I just wanna handle this type of format into my own desirable format. 2017-09-10T18:35:00+05:00 I just wanna convert this date into Epoch Time and then I settle the date in my desire format :: for J-SON or i wanna convert this date into less figure i.e Sun , 9 september 9:23 Am etc. http://dataservice.accuweather.com/currentconditions/v1/257072?apikey=JTgPZ8wN9VUy07GaOODeZfZ3sAM12irH