I’m trying to build a simple data logger collecting I/O points (mostly just analog values), from the Opto Epic (we have PAC Controller also.
Basically need a timestamp, roughly 10 analog points collected every 5 seconds, put into one CSV file (each day would be a new file name based on date: 2024-01-23) and within the csv file it would have a column for the timestamp, value 1, value 2, value 3…etc.
Hi Beno, this worked, however, I can’t seem to figure a way to add a timestamp to each line of data collected. For example, if I run an interval of 5s, I want to see the date and time for each interval. Any suggestions on how to do this?
There are two ways to do this, if you are using an inject node you could set it to inject msg.timestamp = timestamp and have that be a part of the CSV.
Without an inject node you can get the current timestamp at any point with a change node like this:
If you need a more specific time format, your best bet is to use a function node, here’s an example:
I have an older forum post you can check out for other ways you can format date and/or time with the JavaScript date functions, it might be useful for you:
Hi Terry, I do have it as an injector for timestamp and it does come up with a timestamp [1706107469370] but needs to be converted using the normal conversion calculation; however, for some reason in Excel 365 I can’t get it to convert - it comes up with #Value. Have you experienced this in MS365 Excel? Any other tools or calculations I can use to get around this - or better yet, can I add something in (not being an experienced programmer) to my nodes to have it populate in proper MM:DD:YYYY hh:mm:ss?