Skip to Content

How to set date and time created in a db table

Aug 22, 2017 at 09:54 AM


avatar image

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Mike Pokraka 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 :-)

Show 1 Share
10 |10000 characters needed characters left characters exceeded


I agree with Mike. I always use SY-DATUM and SY-UZEIT for DB entries and if I need a timestamp or a local Time display I use classes like that :