Formatting dates in a table

OK, I’ve spent hours going round and round pages on here trying to solve this, and am getting no closer. I’m reasonably tech savvy, and have done a bit of Basic coding in my time, but am not trained in Java - in fact the reason I use Wix is that pretty much everything I want to do is easy without coding. Until now. I have a dataset with a list of events in it including the date of the event. The dataset (or Collection) is called Events, the Field name is called Date, the field key is date. And I have a page which has a table, linked to the dataset, which displays the events. So far so easy. But I’d like to display the Date column in the table with just the date, not the time. I’ve spent hours looking, but cannot work out what code I need to do this. There’s lots of pages of similar issues, but most seem to use repeaters, or dynamic pages, neither of which I’m using.
If some kindly soul could advise what I need to put in the on ready function that would be VERY helpful. Obviously I need this to work for each row of the table as well.
Is this requirement so unusual? I must say I am amazed this is not a built-in function, but the only date format options I can see are MM-DD-YYYY or DD-MM-YYYY, and both append the time whether you want it nor not. Come on Wix, this must be one of the simpler things to do…
TIA, Chris

OK, this is getting more frustrating. Not having had any replies, I’ve been looking at alternate ways to do this. I’ve discovered that if you create a text item on a page and connect it to a Date/Time field in a dataset, it comes up with a whole variety of date formats - some with the time and some without - to choose from. Ditto for a text box in a repeater.
So the function to create all sorts of date formats already exists within Wix! As far as I can see, the only place you CANNOT use it is in a column in a table which is linked to a Date/Time field. This is absurd! Does anyone from Wix read these posts, and is there an answer? Getting a bit frustrated here… I’ve found 2 other threads that were asking the same question, and neither of them were answered either…

I have the exact same problem. Have you found a solution?

No! And no response from Wix either. Am a bit disappointed they clearly don’t have anyone monitoring these threads. I put in a request for this as well, and heard nothing back. So Wix get nil points for customer service IMO… Good luck!

Having been a developer in the Oracle world for many years, I find this kind of limitation very disappointing too.
Thanks for getting back to me. I will let you know if I figure anything out.

Did anyone get a response to fix this issue? Having the same problem and tried lots of workarounds, but nothing is fixing the date issue in a table which I’m using code to get the date - it appears as long format but I want to show as short date format. Have Wix fixed this yet - if s what is the code snippet to get the correct date format into a table???

Hello from the Velo DevRel team!

You should be able to solve this with JavaScript using the toLocaleDateString() method built into the language.

More about how to do that with Velo and JS here:

https://support.wix.com/en/article/velo-formatting-dates

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString

Let me know if there’s anything else I can do to help!

Thanks,
Rob

The question was about formatting dates in a Table. I have also tried solving this and I don’t see how the suggested solution can be applied to the Wix Table element. What are we all missing?
The only suggested solution I have seen that I know would work is to store the date value in the table as a string in the format you wish to display. This is not an acceptable solution for me so I did not implement it.

It stagger - and depresses me - that Wix expect their clients to write JavaScript to make up for deficiencies in their own code. The reason we (well, me at least) use Wix is that we do not want to become expert coders. That the code to do what we want already exists in Wix is evident from the fact that the functionality we are asking for is easily available in other parts of the Wix environment. Just not in the table. How hard can it be to make it available??

OK - I’ve now fixed it - myself! Most of the answers here relate to Repeaters, or Text boxes - I’m using a TABLE, and this does not use the same parameters for dates as do Repeaters or Text boxes. The change I made was simple enough - I used the date type in the column (instead of string) for my table as such:

“id” : “col2” ,
“dataPath” : “date” ,
“label” : “Date” ,
“width” : 100 , // Column width
“visible” : true ,
“type” : “date” ,
“linkPath” : “link-field-or-property” ,

What format is the date displayed in - in the table? Perhaps a screen shot?
I have no problem adding a date to a Table. What I have not been able to do is control/specify the display format of the date. I don’t see anything in your answer that specifies the format for the date.

This is the database date setting:


This is the table setting for the date (scroll down the settings to find the date setting):

This is the code for displaying the date in the 2nd column:
“id” : “col2” ,
“dataPath” : “date” ,
“label” : “Date” ,
“width” : 100 , // Column width
“visible” : true ,
“type” : “date” ,
“linkPath” : “link-field-or-property” ,
}]
This is the output:

The date is formatted as en-GB in the database (DD/MM/YYYY)
Hope this helps.

Yes, there are TWO options. Better than none but not what is needed in some cases and no way to specify other formats.
Thanks, though, for the clarification. And may I also point out that the solution provided by the Wix developer was NOT the solution you documented.