Getting incorrect sent date/time from google api - gmail-api

I recently wrote an app that calls google's api to get a list of threads from a users inbox. For some of the emails I'm getting an incorrect sent time. For example, I just queried it for a user and it's currently 3:55pm EST here and yet the Date header has the value of Mon, 11 Sep 2017 19:14:53 +0000 - 7:14pm EST. Each time I've encountered a time in the future it has the +0000 at the end of the string. I'm assuming that's a timezone offset, but if it was, wouldn't it have a value other than 0?

Related

suiteCRM API dates are incorrect

We recently did an upgrade on our CRM to version 7.12.5 (I'm not sure what version we upgraded from). Previously, on the API, the dates I'd be looking at were always in +00:00 (GMT). I.e., 01-01-2023T13:00:00Z-00:00. This is a correctly formated ISO8601 datetime representing Jan 1st 2023, 1PM, in GMT.
Now they are like 01-01-2023T13:00:00-05:00. Except that the 13:00:00 part is actually the GMT time stored in the MYSQL database. So it's like a GMT time, with a -05:00 timezone slapped onto it. This makes no sense to me.
An example- I create a record at 13:00:00 EST. In MariaDB, it displays correctly as 18:00, but when I look at the record in an API call, it displays as ...T18:00:00-05:00.
EDIT: There's also situations where the date_entered and date_modified fields are in two different timezones(?!). I.E.:
"attributes": {
...,
"date_entered": "2018-09-17T13:38:00-04:00",
"date_modified": "2020-02-27T16:12:00-05:00",
...
}
Previously, these were ALL in -00:00.
Any idea on why this could be? I don't have full admin access on this server but I may be able to provide more information if needed.

Save Date on SQL Server with wrong timezone

I have this:
Clock = Date.now();
this.newReport.DateTime = new Date(this.Clock);
Client side the date is ok: Mon May 20 2019 19:08:34 GMT+0200
But on SQL Server it is save with time 17:08
Why?
Thanks
It looks like that's the same date, when you include the Timezone offset. If the "client side" date is GMT +0200, then the datetime stored should be 17:08:34 (as GMT time).
You're not including much detail, but I expect that you are wanting to save the time as local time. You could either convert the time to Localtime before saving it (and lose the additional information about the timezone), or save the GMT offset along with the date and time so that you could have both available if you wanted to convert it back to localtime later.

Apache Camel Kinesis pause/resume throws ExpiredIteratorException

I've a Camel route that gets the record from a Kinesis stream. I accidentally paused the route and enabled it 10 minutes later. The Kinesis iterator expires after 5 min. Eventhough the route is resumed, the Camel/Kinesis component seems to be holding on the expired iterator and is unable to get records from the kinesis stream. Is there any way to fix the issue without a restart?
amazonKinesisClient=%23KinesisClient&iteratorType=AFTER_SEQUENCE_NUMBER&maxResultsPerRequest=100&sequenceNumber=4957961397643123123123123933769851155815690236067842&shardId=shardId-000000000000.
Will try again at next poll. Caused by:
[com.amazonaws.services.kinesis.model.ExpiredIteratorException -
Iterator expired. The iterator was created at time Thu Mar 22 02:32:32
UTC 2018 while right now it is Thu Mar 22 03:54:44 UTC 2018 which is
further in the future than the tolerated delay of 300000 milliseconds.
(Service: AmazonKinesis; Status Code: 400; Error Code:
ExpiredIteratorException; Request ID:
f5434586-4645-45d9-a66a-1232d2e45678)]

Datepickers are not returning chosen dates

Here's the problem with my datepickers.I tried three approaches which ultimately gave same wrong result.
Input type date:
<input type="date" ng-model="d.e_date" class="date"/>
Result: returned 2016-03-31 on choosing 1 April 2016 and 2016-04-06 on choosing 7April 2016.(One Day Back)
UI Bootstrap's datepicker and Jquery's datepicker:
Result: they also gave same result for format "yyyy/MM/dd".while i used them with format "MM/yyyy" and they returned 12/2013 on choosing January 2014 and 11/2015 on choosing December 2015.
Conclusion: As far as i could understand,it is somehow subtracting one point.like one day back in full date format and one month back in month's format.
datepicker date off by one day
This is the link i checked and also tried replacing "-" with "/" as mentioned in above post but no luck.
Update:
I am actually getting this date value in Angular controller and sending it to server.In Controller date is returned in "Thu Apr 01 2010 00:00:00 GMT+0500" on choosing 1st april 2010 while when its is submitted to service as
console.log($scope.s_month);// returns this Thu Apr 01 2010 00:00:00 GMT+0500
Restangular.all("s_session/create").post({s_month:$scope.s_month}).then(function(response){
console.log(response);
});//returns '2010-03-31T19:00:00.000Z' according to browser's network tab.

Golang - Timestamp losing year after formatting and storage

I am using the Go runtime to store entities in the Appengine Datastore sequenced by the time they were added; to store the timestamp in the key I am formatting the timestamp using the time.Time.String() method and storing the string version as the key.
To get the Time back again on retrieval I use time.Parse:
time.Parse("2006-01-02 15:04:05.000000000 +0000 UTC", the_timestamp)
In unit testing this functionality independent of an app (using cmdline - goapp test) my tests retrieve the timestamp in its entirety no problem.
But when I import the package doing this into an appengine app and test it (using cmdline - goapp serve) the timestamp is stored with its Year field set to "0000"
When you are converting your time to string before saving into datastore, the extra 0s at the end of time are removed.
So,
2009-11-10 23:00:00.12300000 +0000 UTC
is converted into
2009-11-10 23:00:00.123 +0000 UTC
Now when you retrieve it from datastore and use the Parse function, it tries to match upto 8 digits after decimal. Hence the error.
So, while converting the time into string, you need to Format the string so that 0s are not lost.
const layout = "2006-01-02 15:04:05.000000000 +0000 UTC"
t := time.Now()
tFormat := t.Format(layout)
http://play.golang.org/p/elr28mfMo8

Resources