Wednesday, December 19, 2007

Show friendly time in ArcSDE system tables

I came across a posting about time conversion in ArcSDE system tables in ESRI Support web site:

http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=25700

In the ArcSDE system tables, the dates are stored as a number that represents the time when the table was registered, or the layer was created, in seconds since 1970.

SELECT registration_id, table_name, OWNER, TO_CHAR(NEW_TIME(TO_DATE('1970-01-01', 'YYYY-MM-DD'),'GMT','PDT') + registration_date / 86400.0, 'Month DD, YYYY HH:MI:SS am')
FROM sde.table_registry;

SELECT LAYER_id, table_name, OWNER, TO_CHAR(NEW_TIME(TO_DATE('1970-01-01', 'YYYY-MM-DD'),'GMT','PDT') + CDATE / 86400.0, 'Month DD, YYYY HH:MI:SS am')
FROM sde.LAYERS;

No comments:

Post a Comment