Set datetime cell to current time when a row is edited

Set datetime cell to current time when a row is edited

ngungongungo Posts: 64Questions: 23Answers: 2

Hi,

I am looking for hints how to do the following. Thanks in advance.

In this example link, I would like to have the Modify date automatically set to current date after the row is created or edited, without including it in the edit form.

This question has accepted answers - jump to:

Answers

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394
    Answer ✓

    If this is a MySQL database, you need a timestamp column with a default value of "CURRENT_TIMESTAMP" and an attribute of "on update CURRENT_TIMESTAMP".
    Modifying any field will then add current timestamp to the row.

  • ngungongungo Posts: 64Questions: 23Answers: 2

    Thank you so much. It works like a champ. :)

  • BTalayiBTalayi Posts: 18Questions: 4Answers: 0

    Hi,

    How we can do it in a sql database? should I create a trigger on my table?

  • colincolin Posts: 15,112Questions: 1Answers: 2,583
    Answer ✓

    Hi @baharptalayi@gmail.com ,

    Yep, that's a good way to go. This SO thread has some details,

    Cheers,

    Colin

  • BTalayiBTalayi Posts: 18Questions: 4Answers: 0

    Thanks colin, it works well.

This discussion has been closed.