find Date Difference in Milliseconds - hiveql

I have two fields in hive : forwarddate & recieved date.
forwarddate has values like : 2018-07-18 01:51:30.655 +0200
recieved date has similar values.
I want to find the difference between forwarddate & recieved date in milliseconds

Related

mongoDB is adding 4 hours and 5 hours to date field while inserting date format(YYYY-MM-DD) through datastage ? is this the normal behavior?

case#1 -- when inserted the date format (2015-08-01 ) , in mongodb it shows as 2015-08-01T04:00:00.000Z, where i expected it to be 2015-08-01T00:00:00.000Z
case#2 -- when inserted the date format (2016-01-01 ) , in mongodb it shows as 2016-01-01T05:00:00.000Z
where i expected it to be 2016-01-01T00:00:00.000Z
source data type used data stage : Date
target data type specified in mongoDB : Date
Question here is why 04:00:00 timestamp is coming even though source has only YYYY-MM-DD(with out time stamp) ?
can some one help to clarify this ? is this usual behavior of mongodb ? is there any thing i can do to have only timestamp as T00.00.00.000Z at target.
requirement is to not convert the date into string format ..

Turning a localized Date to a Timestamp in Firebase

I'm new to Firestore and since it doesn't seem like it has a native createdAt/updatedAt as part of a document, I'm creating them when I create the new document. Using a straight up Date() as the value for my initial dictionary that I save to Firestore obviously gives me a localized date/time – UTC -500, for example.
Firestore stores this as November 19, 2018 at 5:14:54 PM UTC-5
Is there a specific date format that Firestore likes in order to save something as a Timestamp and so that I will be able to sort on it later?
I tried using "yyyy-MM-dd HH:mm:ss Z" as the dateFormat from just printing out the value of Date() in a Playground. Would love some help here. Thanks!
A Timestamp object doesn't have a date format. It's just a measurement of a number of seconds since Unix epoch, plus some number of nanoseconds. It does not accept a formatted time. If you have a formatted time, you will have to parse it to get a Timestamp object in return.`
The date format you're seeing in the console is just the way the console is choosing to format it. If you want to format a Timestamp for display, you'll need to do that yourself.

Date format issue in UI5

I have a Odata service which brings back audit date and time in following pattern
AUDIT_Date : Sun Nov 23 -4713 16:07:02 GMT-0752 (Pacific Standard Time)
AUDIT_time: :
ms:0
__edmType: "Edm.Time"
in metadata I see the format as :
<d:AUDIT_DATE m:type="Edm.DateTime">0000-00-00T00:00:00.0000000</d:AUDIT_DATE>
<d:AUDIT_TIME m:type="Edm.Time">PT0H0M0S</d:AUDIT_TIME>
I am trying to create a new record and while doing so I need to pass current date and time in those fields. I saw some blogs on date formats but none is giving me clear example on how I should solve this issue.
The data object I am trying to pass to OdataModel.create is "parts"
and need to pass
parts.Audit_date = "current date"
parts.Audit_Time = "current time" in those formats.
for example:
parts.Audit_date = "/Date(1354665600000)/";
parts.Audit_Time = "PT11H00M00S";
the date is ms since 1970 and the time is 11 hours 0 minutes and 0 seconds : )
this is the best blog to find information about edm dates and times in my opinion:
https://blogs.sap.com/2013/04/28/working-with-odata-dates/

In what format is this time: 568399396

in my current project I need to work with data from a certain loger. Unfortunately, I encountered a problem of coding the date of this loger. I believed that it is a timestamp date format but it is not. Can you tell me in what format is this datum
Real date:
04-Jan-2018 16:43:16
Date format:
568399396
That date-time format is called epoch, where the date is stored as an integer. It is the number of seconds/milliseconds after 1st January 1970, 00:00:00. This is how all the computers/devices store the date/time internally.
You can use n number of libraries to convert an epoch to date/time etc.
You can read more about epoch here:
https://en.wikipedia.org/wiki/Unix_time
P.s.: Are you sure that you're getting this number for 4th Jan 2018? The epoch of 04-Jan-2018 16:43:16 will be 1515064396000(in ms)

How to store Indian date and Time in MongoDB ? and How to query using Time fileds(HH:MM:SS)

What is the best way to store indian date and time in mongodb?
I'm going to upload bill details in mongodb. So i've to capture the Bill time which is printed in Bill. This will be in the format like '2014-12-22 14:10:25'. ISODate is good solution? How to covert above date value into ISODate format? Is there any default fuction avilable in mongodb?
How to query the documents based on time elements.For example hourly wise document search.
Please advice
that is possible through JavaScript's Date objec, that supports the ISO date format, so as long as you have access to the date string, you can do something like this:
> doo = new Date("2012-07-14T01:00:00+01:00")
Sat, 14 Jul 2012 00:00:00 GMT
> doo.toTimeString()
'17:00:00 GMT-0700 (MST)'
If you want the time string without the seconds and the time zone then you can call the getHours() and getMinutes() methods on the Date object and format the time yourself.
if any problem please comment me..)