Support Topics Documentation Slack YouTube Blog

DateTime from 1561500000000 to 2019-06-20T10:23:40+0000

Hi,
in Dropsource there is an action that called “Create a Date from a Date-Time String”. The input string has to be like 2019-06-20T10:23:40+0000 but the API call get a number like 1561500000000. Of course the action doesn’t work.
What I can do?

Thanks!

like unix time in milliseconds, 1561500000000 millisec = 1561500000 seconds =

06/25/2019 @ 10:00pm (UTC)

2019-06-25T22:00:00+00:00 in ISO 8601
Tue, 25 Jun 2019 22:00:00 +0000 in RFC 822, 1036, 1123, 2822
Tuesday, 25-Jun-19 22:00:00 UTC in RFC 2822
2019-06-25T22:00:00+00:00 in RFC 3339

Ok thaks, but it doesn’t solve my problem.
Dropsource except only the ISO 8601 format.

You mean that you get a response with backendless DATETIME field values in the format 1561500000000?

Do you want to convert unix time stemp to ISO 8601 format for sending to Dropsource?

What language do you use?

Do you want to convert unix time stemp to ISO 8601 format for sending to Dropsource?

Yes.

What language do you use?

No language.
Do I have to write a script in Backendless? Like Js. I’m not able to do that.

Please describe in more detail what and how you are doing, what you want to get in the end.
I will try to find out whether it can be done and write here.

Hi Mario

If you use Business Logic you can transform your data response before return it, you can use there
toISOString method, for example

yourApiMethod() {
  const list = [
    { date: 1561046300034 },
    { date: 1561046300034 },
    { date: 1561046300034 },
    { date: 1561046300034 },
  ]

  ...

  return list.map(item => ({
    ...item,
    date: new Date(item.date).toISOString()
  }))
}

each date will be transformed to ISO 8601 string

new Date(1561046300034).toISOString() // "2019-06-20T15:58:20.034Z"

Regards, Vlad

or you can use afterFind EventHandler for specific DataTable

take a look at the doc: https://backendless.com/docs/bl-js/bl_event_handlers.html

or you can use afterFind EventHandler for specific DataTable

take a look at the doc: https://backendless.com/docs/bl-js/bl_event_handlers.html

Ok @vladimir-upirov I want to try this way. Thanks for your help.

The logic is, the client send an API request to get the data, before it get the data I have to change it with the .toISOString() function. So before the server sends the data the function .toISOString() has to change the format. Could it work like this example, or the converted data has to stored in a new cell of the data table?

you can choose any of these ways:

  • use Business Logic
  • or keep it in another column

but I would choose the first variant

Ok, is there a way to get support for this and other tasks directly from Backendless’s develpers?

We have good documentations. Please start by reading the documentation Business Logic https://backendless.com/docs/bl-java/

Thank you for your help, but this is not the answer that I am looking for. I want to subscribe a plan and I need also help to build some features in Backendless. Any suggestions?

Do I understand correctly? You want to create an application on backendless, and you need a help to figure out? but you don’t want to read the documentation?

No, I’m trying to make an event handler in codeless while I check documentation and see video tutorials. But I need to much time to get what I want.

I think that a Backendless developer could get it in a couple of hours.

Please, write in sales@backendless.com, to discuss the terms and conditions

1 Like