Date Picker: Set a specific date and Unix Date/Time Conversions

I’m using the Date Picker which is handy but I have found 2 challenges:

  1. You cannot SET the date you want when you show the calendar. I don’t want it to default to “today”. I want it to default to the date I give it.
  2. Some backend DB’s use UNIX datetime values. Thunkable seems to have no way of converting between UNIX and Gregorian calendars and vice versa. I have had to invoke a web API in order to do this and this just slows things down and is not necessarily 100% reliable. ie: I need to either get a UNIX time in milliseconds since 1970 and send that to the Date Picker Calendar to show the real date, or get the user selected date from the Date Picker and send that to the DB in UNIX milliseconds. So Thunkable needs some date and time conversion options.

Please advise if and when this will be available.

1 Like

Hi Thunkable
Can you provide some feedback on this?
Thanks

Check out this postv
H

1 Like

Hi Yes,
I’m using EXACTLY that solution.
The challenge I posted was:

  1. You cannot SET the Date in the Date picker other than have it default to the current date. This is not useful if you have an existing date that the user may want to update in the date picker.
  2. Yes, I am using that API but as I mentioned it would be quicker and more reliable if that functionality was native to Thunkable.

These questions go back to some old posts as well and these have never been satisfactorily addressed unfortunately.

1 Like

You do not need an API for the unix timestamp. Just use a quick HTML page that returns this JavaScript code:

new Date(“06 Jul 2022 17:30:00 GMT”).getTime() / 1000

You should get the unix timestamp.

If you want to get the standard date from unix timestamp then use this
new Date(1657125944000).toUTCString()

Remeber, JavaScript unix timestamp is in milliseconds therefore you need to account for 1000 to be multiplied into or divided by the number given by the seconds since 1970 block in Thunkable.

4 Likes

Thanks Muneer!
Anyone know when it will be possible to set the date up-front in the date picker to any specific value?

1 Like

What worried me, at the outset, about using a 3rd party UNIX date time converter has come to past.
ie: It is broken and has not been working since 27 September.
https://showcase.api.linx.twenty57.net/UnixTime/fromunixtimestamp?unixtimestamp=1549892280
Can anyone suggest a better replacement?