Skip to Content

How to set date and time created in a db table

When creating new DB tables in ERP, I want to add also columns to carry the time stamps for creation and last change.

SAP standard tables normally use a DATE and TIME field for that (ERDAT/ERZET). But since the DATE is relative to the time zone, I tend to using a TIMESTAMP field. What do you think? Do you use TIMESTAMP or DATE/TIME fields for this purpose?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Aug 22, 2017 at 11:32 AM

    With my techie hat on I agree timestamp is more accurate and has certain benefits. But from a usability perspective I find them a pain to work with. How often do you want to find stuff that happened in a date range vs stuff that happened during a specific time interval? With dates you have the calendar dropdown in SE16 to tell you that the first week of this month was 20170807000000 - 20170813235959. So, give me date and time please.

    Using sy-datum is universal and time-zone independent as it is the system date. So I would always use date and time, and if I have a specific need for a timestamp, I add this as an extra field. SAP seems to follow this, the only tables only with timestamps are low-level techie tables. Not many users are going to poke around ARFCSSTATE :-)

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 31 at 09:23 AM

    For this purpose I'd use DATE/TIME. At least, it seems more logical to me. Actually, i was using this for DB table and by far it's been working fine. You should use DATA/TIME.

    Add comment
    10|10000 characters needed characters exceeded