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.
Related
When I use the Material Design date picker in my Angular code, to set a date, which I then send to my REST server with a MySQL database and a TIMESTAMP column, I get the error message: "Error: ER_TRUNCATED_WRONG_VALUE: Incorrect date time value:"
The reason for this is, that the date picker exports the date in the following date format ("2022-02-23T23:00:00.000Z"), while MySQL expects a date format like this: "2022-02-17 12:55:31".
How can I configure the date picker to export the date in the correct MySQL format? I know that there are ways to configure the MySQL server to accept this special format, but I'd prefer to do it on the client side.
See Moment.js, you can manipulate dates easily.
const formatedDate = moment(yourDate).format('YYYY-MM-DD HH:mm:ss')
I am pulling a date from a JSON array called closeDate - using a subquery with data->>'closeDate' as PortalCloseDate which returns a string with the date format YYYY-MM-DD. I am trying to convert it to a date. When I return the column I have tried cast(cls.PortalCloseDate as date) and get the error message: ERROR: invalid input syntax for type date: "2020-12-09"
I have also tried to_date(cls.PortalCloseDate,'YYYY-MM-DD') and to_date(replace(cls.PortalCloseDate,'-',''),'YYYYMMDD') but get the error message: ERROR: invalid value "2" for "YYYY" Detail: Value must be an integer.
I need this to be a date data type since I am using calculations to find the time between two dates. Any help is appreciated.
edit: I exported to csv and there are a few dates with a different format than the rest. dates in csv For the majority of the dates they were automatically put in a date type but for the row with the date 2020-12-09 it was in a general format. I have attached a screenshot of the csv
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.
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.
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.