How to parse this date: 2017-11-28T23:00:00Z in custom Integromat app? - make.com

Does someone have complete solution how to parse this date: 2017-11-28T23:00:00Z?

Currently, the only format that does not need to be parsed manually is the one that includes milliseconds: 2017-11-28T23:00:00.000Z.
In your specific case, use parseDate(your-date-field; YYYY-MM-DDTHH:mm:ssZ).
The date/time parsing tokens are explained here.

Related

Date parsing errors when timezone does not exist with Java OpenAPI generator client

I'm working on integrating with an API that (unfortunately) does not always append the timezone offset to their date. I know this isn't optimal but I can't change their behavior.
Example:
2022-06-08T16:07:13.96
Using the java generator and the java8 date library produces a runtime error while parsing the date:
java.time.format.DateTimeParseException: Text '2022-06-08T16:07:13.96' could not be parsed at index 22
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2052)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1954)
at java.base/java.time.OffsetDateTime.parse(OffsetDateTime.java:404)
at com.acme.openapi.JSON$OffsetDateTimeTypeAdapter.read(JSON.java:287)
From my limited understanding, I believe that ISO-8601 dates should be treated as local dates instead of offset dates if the zone offset is omitted. Im unsure if this is something that is supported in the java generator.
I ended up swapping the date library to java8-localdatetime but it gave GSON some problems:
Expected BEGIN_OBJECT but was String
I changed to a jackson based client and that cleared everything up.
I use this nasty wrapper everywhere, where I use a DateTime from the API, to "hack" it in the current timezone.
DateTime utcHack(DateTime dt) {
return DateTime.parse(dt.toLocal().toString() + "Z");
}
I am open for improvements!

Format date/time using local time zone

In Flutter I need to parse and format date/time based on what my REST API passes back. The date/time format the server sends back is 2020-01-28T13:52:30.878+0000. In this example based on my locale it should be formatted as 8:52:30 AM EST. Does anyone know how I can achieve this using either a standard Dart package or some third-party package?
Just figured it out, using DateTime class there is a method toLocal() that does exactly what I need.
You can use DateTime.parse("2020-01-28T13:52:30.878+0000") to parse this format.
if GMT+5
formatedTime = DateTime.parse("2020-01-28T13:52:30.878+0000");
farmattedTime.add(Duration(hours: 5));

2sxc: Field Date and Time default value

I need to have in my fields a datetime content type.
Looking for documentation I found same here http://2sxc.org/en/Docs-Manuals/Feature/feature/2874
Date and Time
no relevant settings to explain. Note that the
output-template will usually choose to show only the date, only the
time etc.
So it's the same data-field no matter what you're actually
entering.
How can I set a default date value like a Datetime.Now for the editing input data field?
I tryed with varius commands but it gives me invalid date.
I alsa tryed the dnn token [DateTime: Now] but it doesn't work.
Thanks
To prefil the date-time there are two options
the link in the dnn-page which creates a new-item could pass this in as a prefill - http://2sxc.org/en/Docs-Manuals/Prefill-new-Forms
there is a hidden API which could do it using JavaScript, but it's not official yet, fairly technical and still prone to change. So I would use #1

Mandrill Templates With Handlebars - How To Format Date

Mandrill has a great feature that allows one to use Handlebars in templates to customize email content. See docs here.
One of the helpers that Madnrill supports is date that can be used like {{#date}}. The default date format is d/m/Y. My question is how can I specify a different date format (e.g. yyyy)?
I need to display something like 2015 Name. I tried:
{{#date yyyy}} Name - displays 05/31/15 (default format and seems to erase any HTML after it).
{{#date 'yyyy'}} Name - displays {{#date 'yyyy'}} Name (can't be parsed).
{{#date yyyy}}{{/date}} Name - displays 05/31/15 Name (default format).
{{#date 'yyyy'}}{{/date}} Name - displays {{#date 'yyyy'}}{{/date}} Name (can't be parsed).
Appreciate you help ;)
The issue was 2-fold:
You should use {{date}} instead of {{#date}}
You should use double quotes for formatting
The correct syntax would be {{date "Y"}}.
Mandrill also updated their docs that now provide more details on handlebars syntax.
I would assume this may follow the original Merge Tag formatting. Have you tried this?
http://kb.mailchimp.com/merge-tags/all-the-merge-tags-cheatsheet
Use |DATE:FORMAT| to show the current date in a given format. For example, |DATE:d/m/y| where d is replaced by the day, m by the month, and y by the year. View a full reference of date options on the PHP website. This format isn't available for automation workflows.

Specify datetime format for WCF Data Service

Is there a way to specify the formatting of DateTime data returned by a WCF data service?
This question seems to say that the default format, which looks like /Date(1339515455030)/, is the number of milliseconds since midnight Januery 1, 1970 UTC. I can figure out how to parse that if I have to but I'd rather specify a more friendly format.
The OData DateTime format (assuming you haven't already formatted it out to a string) is dependent on the wire format negotiated between client and server. The format above is from JSON Verbose and corresponds to a standard JavaScript Date object. The Atom format is different, and JSON Light is different still. Of special note is that we decided to move away from the traditional JavaScript Date format in favor of ISO 8601 for JSON Light. In any of these cases, if you're using a client such as the WCF DS client or data.js, the client will take care of deserializing the value properly.
Atom formatted date: <d:OrderDate
m:type="Edm.DateTime">1996-07-04T00:00:00</d:OrderDate>
JSON verbose formatted date: "OrderDate":"\/Date(836438400000)\/"
JSON light formatted date: "ShippedDate":"1996-07-16T00:00:00"
For current client libraries on a variety of platforms, see here: http://www.odata.org/libraries
With OData V3 the JSON Verbose format uses the ISO 8601 which seems to be more friendly to some consumers. Note though that it will only be used if the payload is V3. So you will need to update your server side to supper OData V3 (if it's WCF DS, then you want to use the WCF DS 5.0 release which can be found for example on NuGet http://blogs.msdn.com/b/astoriateam/archive/2012/05/18/wcf-data-services-5-0-1-released.aspx).
Once you have that you might need to force the server to use V3 in the response payload since by default it will use the lowest possible version for the response. This can be done by sending a MinDataServiceVersion: 3.0; header with the request from the client.
After this even JSON Verbose payloads should use the ISO date time format.
I believe that you should be able to feed the string value sent back into the datetime.parse(http://msdn.microsoft.com/en-us/library/1k1skd40.aspx) and shouldn't have to worry about the rest
Here is an example usage: http://www.dotnetperls.com/datetime-parse

Resources