Logging OPC Data with Custom Time Formats

5 min read

Feb 15, 2024 2:00:00 PM

When logging data to a database or text file, the way that data is presented is essential due to the implications it has for who, or what, is reading this data to make decisions. Without the correct configuration of the data’s timestamps, records can easily become misinterpreted or sorted in non-chronological order by further systems. It’s critical that your data logging solution provides flexibility to get your data when you want it, how you want it, and stored the way you want it. Providing full control of the timestamp format for many users is not just a feature of our OPC Data Logger, but a requirement based on other connected systems and standards. Customizable Time Formats is the focus of today’s blog, but it is just one of the OPC Data Logger’s many flexible features that have our fans raving over it.

Introduced in release V4.0.0.2, the capability to add new custom time formats was added directly into the UI. Previously, adding additional time formats in OPC Data Logger required manual modification of the application’s configuration files. While this method was successfully implemented by many users over the years, it introduces unnecessary risk of accidental changes in the configuration file that subsequently could affect the entire logging operation. Unexpected downtime for your logging solution is something we want to help prevent for all users, so based on widespread usage of this feature, we took feedback from you and our support team and made things better!

Data Presentations

When creating or modifying a Presentation mode in OPC Data Logger, each entry will have an optional FormatString field with a variety of preloaded options. The focus of this blog will be specifically covering the usage of FormatString configurations for Timestamps; other formats for non-timestamp items are outside the scope of this article.

OPC Data Logger Detail Mode

OPC Data Logger Format String Select

Existing users will likely recognize the standard list of provided formats. The enhancements introduced in V4.0.0.2 will now display an additional option at the bottom of this list to ‘Add new format…’

OPC Data Logger Add New Format

Getting Started with Custom Formats

Selecting this new option will prompt users to input a Date Format, which follows Microsoft .NET date and time format string standards. Check out our knowledgebase reference document on available Format Specifiers.

OPC Data Logger Add New Format Dialog Start

The wide variety of specifiers available from the .NET Standard empowers users to fully customize how their timestamps are formatted.

As an example, we will implement a new date format via the display box. 

OPC Data Logger Add New Format Dialog Entry

The full format string “MMMM d yyyy HH:mm:ss.ff” will display in the following format:

  • Original Format: 2024-02-07T16:19:26.15230000
  • New Format: February 7 2024 16:19:26.15

OPCDataLogger_FormatSpecifierTable

Once the format string is entered, and validated, it will appear in the selectable list of items.

OPC Data Logger Detail Mode Finish

Utilizing the custom FormatString in our Data Presentation, we have configured this to log to a local text-file with the following output:

OPC Data Logger Text File Output

The first line of data displays the selected headers, including the Timestamp & Format, ItemID, Value, and Quality of the tag. Each entry/row represents a single tag update with the newly imported Timestamp format!

Where can I get more information?

Whether you’re an existing user or new to OPC Data Logger, we hope this feature provides an easy and convenient interface to customize data to match your needs - either for easier readability by users reviewing text files manually, or for stricter compatibility requirements for Database integrations.

The latest version of OPC Data Logger is available for trial or upgrade of existing licenses on active support & maintenance on our OPC Data Logger website for download. Our OPC Data Logger video resources are a great place to get started.

You can also email us at support@softwaretoolbox.com with your questions and we encourage you to subscribe to our blog for more quick and easy OPC Data Logger tutorials and tips, as well as other helpful information for all of our solutions.

Download Latest OPC Data Logger Free Trial

 

Connor Mason
Written by Connor Mason

Software Toolbox Technical Blog

We're engineers like you, so this blog focuses on "How to" appnotes, videos, tech team tips, product update announcements, user case studies, and other technical updates.  Subscribe to updates below. Your feedback and questions on posts are always welcomed - just use the area at the bottom of any post.

Subscribe to our Blog

Recent Posts

Posts by Topic

See all