Is there a way in SSIS to convert this
2015-10-13T21:03:23.139Z
to DateTime?
The Date above is coming from the mongoDB document as
"createdON" : ISODATE("2015-10-13T21:03:23.139Z")
In my case, I ended up using third party tool (Zappysys) to read MongoDB source and it worked perfectly fine. There is no built in feature in SSIS to parse the above datetime string value.
Related
Setup :
Angular 8 + Spring boot 2.2.3 + (Oracle 12.1 / PostgreSQL 12.3)
We are building a approval System where User can fill online form like google forms and can submit for approval. Rather than normalizing form structure , we'll be storing metadata in JSON format in our DB.
Values that are filled in form would also be going as JSON format in DB.
One point come up as a concern , in DB we can store date in particular format like 12-May-2020 which would be consistent across all inserted data as this data might be used to construct reports in near future.
Based on pros/cons of this approach need to decide on DB / data model as well.
So,
Is there any way I can enforce date format in JSON
If this cannot be done in JSON , what options do i have at Angular 8 / Spring boot application level which would enforce all developers / date components / date fields to use same date format.
If these cannot be done , how can I handle different formats in Query over JSON data that would be used in reporting or otherwise , both in Oracle and PostgreSQL
Regards
The proper solution to your problem is to create a real, normalized date column.
If for some reason you can't or don't want to do that, I would create a check constraint that validates the date format by trying to cast it to a real date value.
The following is for Postgres, but you can create something similar for Oracle as well:
create table the_table
(
form_data jsonb,
constraint check_valid_date check ( (form_data ->> 'entry_date')::date is not null)
);
Obviously you will need to adjust the expression that gets the date value from the JSON to match the key and path inside your json value.
The cast to date will require that the date value is entered using the ISO standard format, yyyy-mm-dd which is the only "consistent" way to store a date as a string.
Alternatively you can use to_date() with a format mask:
check ( to_date(form_data ->> 'entry_date', 'yyyy-mm-dd) is not null)
in DB we can store date in particular format like 12-May-2020
You are mistaken, Oracle doesn't store date in that format. It is internally stored in TYPE12/13 data type. Each bit represents different parts of the date. What you see is a human readable format displayed according to your locale-specific NLS settings or using TO_CHAR with format mask.
To keep it aligned across all platforms, use the globally accepted ANSI standard date literal which uses a fixed format 'YYYY-MM-DD'.
For example:
DATE '2020-05-21'
I am using Apollo server and Apollo React client. The server runs a query against the MySQL database. In GraphQL schema I have defined the corresponding field sampleTime as String in the type Session. (There is no Date type in GraphQL.) But apparently some kind of default conversion is made on the way between the Apollo server and the result of useQuery. The field sampleTime shows the value as a number and not as a string. The number is apparently the JavaScript Date object.
In this case I don't need such a conversion. I found a solution on the server side by converting the SELECT output to the formatted string.
But why this conversion does occur at all?
Thanks
They're pretty stored in the database.
But when i take it from the node and sprinkle it into json, it changes into this format.
YY-mm-dd HH:ii:ss -> YY-mm-ddThh:ii:ss,000Z,
Why does it happen and How can i fix it?
It is getting converted to a date object and when you stringify the javascript object it will call the date.toISOString() format, take a look at this:
Node.js - How to format a date string in UTC
If you post some code we can help you.
I can't understand what format use ArangoDB for date storage.
Attempt to insert date in such format:
{"name": "vasia", "date": date("2013-01-15")}
std.json.JSONException#C:\vibe-d-0.7.24\source\vibe\data\json.d(1116): (1): Error: Expected valid JSON token, got 'date("2013-0'.
It's look like vibed JSON module fail on this string, but what format use Arango?
String in format {"name":"vasia","date":"2013-01-15"} inserting in DB successfully, but I can't understand is it's inserting as text or as Date object?
Is it inserting as text or as
Date object?
As text, because ArangoDB only supports JSON data types. JSON doesn't have a Date type, so dates are usually encoded as strings. How you actually do that is up to you, but since you're using D, I suggest you use Date.toISOExtString. For a few other options, see this question.
I haven't used ArangoDB, but the ArangoDB date documentation suggest you use something like DATE_TIMESTAMP("2013-01-15T14:19:09.522") and / or DATE_ISO8601("2013-01-15T14:19:09.522Z"). Hope this helps.
I am sending a JSON PUT request to Grails. In the JSON object, I have a date string. I have searched and experimented, but I cannot determine the default date string format that GORM wants to parse the date string. In all my attempts I get the following error:
java.lang.IllegalArgumentException: Could not parse date: Unparseable date
I just want to know the default format GORM expects and I will happily format the date string in that format before sending it to the server.
I suppose you face this issue during data binding.
Reason:
Default date format for binding is yyyy-MM-dd HH:mm:ss.S
Solution:
The default data format can be changed using PropertyEditorRegistrar. Follow this for details.