How to present the exact date from database

I’m still experiencing same issue in 3.9.7 ,the format date converts the database datetime date to server datetime, im using Nodejs. How do i do it so that it formats and shows the exact date in the database?

I strip out the ‘Z’ in the date/time string. The ‘Z’ flags it as UTC time. To pull the exact date/time from the database format it as:

“StartTime.replace(‘Z’,’’).formatDate(‘HH:mm’)”

I would suggest a library like dayjs and create custom formatters. It will save you a lot of pain when dealing with dates.

2 Likes

Thanks. I’ll check it out.

How do you store the date, in what database, in what db field type? How is it displayed on the page? Can you share some more info of what do you expect to happen and what actually do you see / happens?

I am storing the date as they appear in the input(datetime-local input) with no special formatting, im using postgres database, the field is timestamp,
When i try to display the date as it is, it displays normal like (2021/02/26t14:00:000:00z) but when i try to format it as 26 feb, 2021 2:00pm, it converts the date to server time.
What i want is that, i want the datetime to formatted as they appear in the db

Thanks, JonL!

That is a very, very useful link!

Do you have other JS utilities on github or elsewhere that you use or would recommend a look at?

Thank you.

1 Like

Have some long fun!

1 Like

This is Astonishing!

JonL, Have you installed these libraries, resources & shiny things so that they are seen as resources inside a Wappler project view – so that things like this can be used with the Wappler Connect framework?

Such as (Example):

Do you mean from the UI? If so, nope. That is not possible yet.
You can create custom formatters and custom components for them, but you will have to work with them in code view.

1 Like

So something like this.

2 Likes

I thought that would be the case.
But, hey, code view is THE best anyway.
Thanks for passing along this link – so many goodies that remind me that really, really smart people are constantly creating solutions for problems we may run into tomorrow.

@JonL Do you use this in addition to Moment or ditch Moment all together?

I ditched it. It’s heavier, outdated and unsupported compared to dayjs.
I will still have to think how to integrate it with other wappler components that rely on momentjs.

1 Like

Yeah, been thinking the same.
Let us know when you figure it out :grin: