Create a link in dashtable to detect the today date and reflect back to database/excel

Hi,

How to create a url link and insert into the column of the dashtable to detect the today date and able to reflect back to the database or excel?

Expected output:

Need to create a link/button called Make payment. When user click the link, then it will detect the today date and update to the database/excel. Therefore, the second row data (highlighted in orange) will show in database/excel and show in the dashtable as well.

1 Like

Hello @beginof,

You don’t need to have dash do this in the table. You can use python date time to insert todays date inside the callback.

But I need a link or button that can track the today’s date (based on the time setting; before 4pm today is tagged today’s date, else tomorrow’s date) when the user click,

then update the date back to my database, so the value that updated in the database will show in my dash table.

Would this be server time or client time?

If server time, its a regular callback that you just query datetime:

today = datetime.datetime.now()

if today.hour > 15:
    today = today + datetime.timedelta(days=1)

today = today.date()

If clientside:

function getDateforInput() {
     today = new Date()
     if (today.getHours() > 15) {
          today.setDate(today.getDate() + 1);
     } else {
          today = today.getDate()
     }
     return today
}