unix-timestamp

Convert timestamp datatype into unix timestamp Oracle

隐身守侯 提交于 2019-11-26 16:39:35
I have a timestamp datatype in database with format 24-JuL-11 10.45.00.000000000 AM and want to get it converted into unix timestamp, how can I get it? Ben This question is pretty much the inverse of Convert Unixtime to Datetime SQL (Oracle) As Justin Cave says: There are no built-in functions. But it's relatively easy to write one. Since a Unix timestamp is the number of seconds since January 1, 1970 As subtracting one date from another date results in the number of days between them you can do something like: create or replace function date_to_unix_ts( PDate in date ) return number is l_unix

Date time conversion from timezone to timezone in sql server

青春壹個敷衍的年華 提交于 2019-11-26 16:36:16
I having an column of UNIX time stamp in my database table, which comes from a system that is in the Kuwait time zone. My database server's time zone is Eastern Time US & Canada . Now I need to convert the UNIX time stamp in to Kuwait time zone date value using an SQL query. Can anyone tell me how I can convert this UNIX time stamp into a Kuwait time zone date value? Matt Johnson Unix timestamps are integer number of seconds since Jan 1st 1970 UTC. Assuming you mean you have an integer column in your database with this number, then the time zone of your database server is irrelevant. First

Behind The Scenes: Core Data dates stored with 31 year offset?

a 夏天 提交于 2019-11-26 16:24:36
问题 I know, "no user-serviceable parts inside" ... but I'm curious: In a Core Data sqlite3 DB, it seems I can get at the date within a ZDATE like so: sqlite> select datetime(ZDATE,'unixepoch','31 years','localtime') from ZMYCLASS; 2003-12-11 19:00:00 2009-12-31 19:00:00 2009-01-24 19:00:00 2011-01-01 19:00:00 2009-10-03 20:00:00 ... Unix Epoch I get, but why 31 years? 回答1: Core Data stores dates relative to reference date, which is Jan 1st, 2001 (31 years after EPOCH as pointed out in the

How to Convert UNIX epoc time to Date and time in ios swift

爷,独闯天下 提交于 2019-11-26 14:58:41
问题 I'm trying to convert the UNIX epoc time to datetime format using the below code var epocTime = NSTimeInterval(1429162809359) let myDate = NSDate(timeIntervalSince1970: epocTime) println("Converted Time \(myDate)") the actual result is (Thu, 16 Apr 2015 05:40:09 GMT) but am getting something like (47258-05-14 05:15:59 +0000) Can anyone please tel me how to achieve this. 回答1: update: Xcode 8.2.1 • Swift 3.0.2 You need to convert it from milliseconds dividing it by 1000: let epocTime =

How to convert ISO Date to UTC date in Hive

巧了我就是萌 提交于 2019-11-26 14:42:13
问题 I have JSON data as below: I need to convert that date or mongo_date into utc timestamp, to analyse the data in hive as per timeline example per year, per month, per week using map reduce { "_id" : ObjectId("51ac77050e9edcdad271ce2d"), "company" : null, "date" : "19760224", "mongo_date" : ISODate("1976-02-24T00:00:00Z") 回答1: Hive understands this format: 'yyyy-MM-dd HH:mm:ss.SSS' . Use unix_timestamp() to convert to seconds passed from 1970-01-01, then use from_unixtime() to convert to proper

How to work with Unix timestamps in Matlab?

寵の児 提交于 2019-11-26 14:03:29
问题 I have some data files with Unix timestamps (in this case, number of milliseconds since Jan 1, 1970 00:00 UTC). I would like to convert these to human-friendly date/time strings (e.g. 31-Aug-2012 11:36:24) in Matlab. Is there an easy way to do this in Matlab, or am I better off using an external library (e.g. java.text.SimpleDateFormat)? 回答1: How about date = datestr(unix_time/86400 + datenum(1970,1,1)) if unix_time is given in seconds, unix_time/86400 will give the number of days since Jan.

MySQL convert date string to Unix timestamp

只谈情不闲聊 提交于 2019-11-26 13:01:45
How do I convert the following format to unix timestamp? Apr 15 2012 12:00AM The format I get from DB seems to have AM at the end. I've tried using the following but it did not work: CONVERT(DATETIME, Sales.SalesDate, 103) AS DTSALESDATE, CONVERT(TIMESTAMP, Sales.SalesDate, 103) AS TSSALESDATE where Sales.SalesDate value is Apr 15 2012 12:00AM Try this Query for CONVERT DATETIME to UNIX TIME STAMP SELECT UNIX_TIMESTAMP(STR_TO_DATE('Apr 15 2012 12:00AM', '%M %d %Y %h:%i%p')) This Query for CHANGE DATE FORMATE SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(STR_TO_DATE('Apr 15 2012 12:00AM', '%M %d %Y %h:%i

Getting “unixtime” in Java

邮差的信 提交于 2019-11-26 12:02:33
Date.getTime() returns milliseconds since Jan 1, 1970. Unixtime is seconds since Jan 1, 1970. I don't usually code in java, but I'm working on some bug fixes. I have: Date now = new Date(); Long longTime = new Long(now.getTime()/1000); return longTime.intValue(); Is there a better way to get unixtime in java? UPDATE Based on John M's suggestion, I ended up with: return (int) (System.currentTimeMillis() / 1000L); Avoid the Date object creation w/ System.currentTimeMillis() . A divide by 1000 gets you to Unix epoch. As mentioned in a comment, you typically want a primitive long (lower-case-l

Convert unix time to readable date in pandas dataframe

半腔热情 提交于 2019-11-26 11:12:19
I have a dataframe with unix times and prices in it. I want to convert the index column so that it shows in human readable dates. So for instance I have date as 1349633705 in the index column but I'd want it to show as 10/07/2012 (or at least 10/07/2012 18:15 ). For some context, here is the code I'm working with and what I've tried already: import json import urllib2 from datetime import datetime response = urllib2.urlopen('http://blockchain.info/charts/market-price?&format=json') data = json.load(response) df = DataFrame(data['values']) df.columns = ["date","price"] #convert dates df.date =

Convert unix time stamp to date in java [duplicate]

吃可爱长大的小学妹 提交于 2019-11-26 10:28:53
This question already has an answer here: Unix epoch time to Java Date object 7 answers How can I convert minutes from unix time stamp to date and time in java. For example, time stamp 1372339860 correspond to Thu, 27 Jun 2013 13:31:00 GMT . I want to convert 1372339860 to 2013-06-27 13:31:00 GMT . Edit : Actually I want it to be according to US timing GMT-4, so it will be 2013-06-27 09:31:00 . You can use SimlpeDateFormat to format your date like this: long unixSeconds = 1372339860; // convert seconds to milliseconds Date date = new java.util.Date(unixSeconds*1000L); // the format of your