Is there a way to set ISO 8601 Compliant Dates as DateTime format in OrientDB? - orientdb

I am a newbie to OreintDB and I was wondering if there is a way to get OrientDB (I am using the 3.0 Release Candidate) to accept all dates as ISO 8601 compliant dates with milliseconds. The DB I am building will store all times in UTC but needs millisecond level timestamps.

Try this:
ALTER DATABASE DATETIMEFORMAT "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
Hope it helps
Regards

Related

Keeping local Timezone information from an ISO 8601, RFC3339 formatted dates in iOS

I know there are tons of post regarding iso8601 strings and timezones but I could not find anything that really pinpoints the problem I had recently.
I have an ISO 8601 RFC3339 formatted string like: 2021-03-31T12:00:00+03:00.
I want to display the time associated with this date in the local time of the provided date meaning I want exactly "12:00" as the output. If my formatter has dateFormat of HH:mm
If I use an ISO8601DateFormatter to extract the date everything seems to work fine and the associated Date object is 2021-03-31 09:00:00 +0000. Which makes sense since 12:00GMT+3 = 09:00GMT+0
However this completely removes Timezone information from the Date object (which I know is by design on iOS).
While I understand the design behind this (most of the time we eventually should display the time in the user device timezone). There are quite a few exceptions like travel applications where we almost alway want to display the local time of departure/arrival.
My solution was to store the json serialized dates as Strings and use a combination of ISO8601DateFormatter to create the Date object in UTC and a normal DateFormatter that reconstructs the TZ from the +03:00 substring.
What's the best approach to solve this ?

Why am I getting iso 8601 dates from my Postgres database?

I'm using Seekwell to connect my AWS postgres database to Sheets.
I think I'm converting my dates to standard 'date' (YYYY-MM-DD) format in the code, eg.
date(date_trunc('day', u.created_at::date)) Date_Created
However, when the query is run, my dates are iso 8601, eg.
2018-05-16T00:00:00.000Z
Of course, given that my results are going into Google Sheets, I can always convert those dates there in sheets, but that adds a layer of complexity that is hard to manage.
How can I make sure the dates are formatted correctly before the results land in sheets?
Michael from Seekwell tells me this is:
a bit of bug with how JDBC handles dates in the background. You're on Postgres, right? This should work from within the add-on:
to_char(your_date_column, 'YYYY-MM-DD')
Sheets will recognize that result as a date.
This worked.

Ext.Date.format wrong format

I am facing an issue in ExtJS with the Date format.
I'm using Ext.Date.format(value, 'm/d/Y h:i:s a') where the value is a date from the database.
While saving a Date 06/29/2018 12:15:00 am to DB it's storing as 2018-06-26 07:30:00
I am getting the Date from Database as 2018-06-28T18:45:00.000Z when converting to Ext.Date.format it changes to 06/29/2018 12:15:00 am.
I need store the date to be same as UI(06/29/2018 12:15:00 am) in db. Is there anyway?
Thanks
The reason might not be ExtJS itself nor your database, but the fact that your server and browser are on different timezones (i.e. Server in USA and browsing in Europe). I can think of two solutions:
1) Store the timezones in the database along with the dates. The record would look something like this: 2018-06-28T18:45:00.000Z+10:00. Use .NET's DateTimeOffset type in your C# code for this alternative.
2) What you can do instead is to convert all dates to UTC in the server side. Probably calling DateTime.ToUniversalTime() will suffice, but you can see this answer for more details.
Then you can use a library like moment.js which helps a lot with date and time manipulation/formatting to display the dates in the user's local timezone.

Knex saves date incorrectly

I have a date field set with table.date('day'); in knex schema. When I insert it with knex('table_name').insert({ someOtherData, day: '2016-08-14'}) and then use knex.select('day').from('table_name') I get [Date: 2016-08-13T22:00:00.000Z]. It seems as if it saves it as '2016-08-14T00:00:00.000Z' and then subtracts 2 hours to conver it into UTC.
This issue may be because of time zone conversion. Have you tried using timestamp?
table.timestamp('response_deadline')
It will convert date datatype to timestamp with time zone.
the docs on schema building seems vague however try to deliver this date string to a js date constructor, i'm pretty sure it will deliver you the correct date.
it tries to represent every date as the specs recommends, that's why you're seeing the date this way.

Store/Index time in mongo, use a timestamp or a date/time

When storing a timestamp in mongodb should I store the 'unix-time' millis since some date or should I store an actual date/time?
What are the benefits of either?
Edit
To be more specific should I store a long that is seconds since Jan 1. 1970, or should I store a Javascript date object.
I recommend using the MongoDB native date format. The advantage of that is that you can then easily use the date operators:
http://docs.mongodb.org/manual/reference/operator/aggregation-date/