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: 2,416Questions: 18Answers: 270
    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: 5Questions: 0Answers: 0

    Hi,

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

  • colincolin Posts: 6,884Questions: 0Answers: 1,176
    Answer ✓

    Hi @baharptalayi@gmail.com ,

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

    Cheers,

    Colin

  • BTalayiBTalayi Posts: 5Questions: 0Answers: 0

    Thanks colin, it works well.

Sign In or Register to comment.