Date/Time type conversion for Sage 300 date fields

By | July 31, 2019

As we all are aware that Sage 300 stores the Audit Date and Audit Time in the SQL tables. Many times there are necessity to check the audits for organizational purpose but user cannot identify the time stored in the table due to its structure. We will be discussing the conversion of the time and date to the format user requires in this blog.

New Stuff:- How to use existing session using COMAPI in C#

In Sage 300 AUDTTIME and AUDTDATE are the fields in which you will get the date and time where all transactions are posted/updated in Sage 300. The fields are only accessible from SQL tables and not available on the screens.

Audit Date/Time:

In the SQL Audit date is stores in the yyyyMMdd format. If a user wants to format the date into the date and time format, so we provided an example of date type conversion for Sage 300 date fields.

Sage 300 ERP SQL Date / Time Conversion:

SQL Server allows us to set up custom user-created queries. You can run the following query then you can get output like “30/07/2019 16:03:32”

SQL Query:




LEFT(LEFT(Right(‘00000000’ + Convert(varchar(8),AUDTTIME),8),4),2) + ‘:’ +

RIGHT(LEFT(right(‘00000000’ + Convert(varchar(8),AUDTTIME),8),4),2)

+ ‘:’ + RIGHT(LEFT(right(‘00000000’ + Convert(varchar(8),AUDTTIME),8), 6) ,2)


from tablename

Audit Time:

GMT format of the Audit time:

In sage 300 AUDTIME is based on GMT format, if user wants to translate the AUDTIME in a different time zone, the user will need to revise the SQL statement. We have converted the GMT time format into the Central Time zone. Refer the below SQL query for the Central Time zone.

Example :

Standard AUDTIME format is : 10333254 (10:33:32 GMT)

After running the query below you get an output like : 16:03:32 IST

SQL stmt to format AUDTIME :


LEFT(CONVERT(time,DATEADD(HOUR,5,DATEADD(MINUTE,30,(LEFT(LEFT(Right(‘00000000’ + Convert(varchar(8),AUDTTIME),8),4),2) + ‘:’ + RIGHT(LEFT(right(‘00000000’ + Convert(varchar(8),AUDTTIME),8),4),2)))),103),5)


RIGHT(LEFT(right(‘00000000’ + Convert(varchar(8),AUDTTIME),8), 6) – 60000,2)



from tablename

About Us:-

Greytrix a globally recognized Premier Sage Gold Development Partner is a one stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix offers unique GUMU™ integrated solutions of Sage 300 with Sage CRM, and Magento eCommerce along with Sage 300 Migration from Sage 50 US, Sage 50 CA, Sage PRO, QuickBooks, Sage Business Vision and Sage Business Works. We also offer best-in-class Sage 300 customization and development services and integration service for applications such as POS | WMS | Payroll | Shipping System | Business Intelligence | eCommerce for Sage 300 ERP and in Sage 300c development services we offer services such as upgrades of older codes and screens to new web screens, newer integrations using sdata and web services  to Sage business partners, end users and Sage PSG worldwide. Greytrix offers over 20+ Sage 300 productivity enhancing utilities that we can help you with such as GreyMatrix, Document Attachment, Document Numbering, Auto-Bank Reconciliation, Purchase Approval System, Three way PO matching, Bill of Lading and VAT for Middle East.

For more details on Sage 300 and 300c Services, please contact us at We will be glad to assist you.