Simple And Easy Way Of Creating A Daily Log Twice Per Day


Recommended Posts

The easiest?


In an Event for one of your channels that updates all the time, put:


logging.mylog.strFileName = "c:\myData\filePrefix_" + formatDateTime("%y%m%d_%p", systime() - 7 * 3600)


Change mylog to the name of your logging set

Change the path and prefix inside the quotes to whatever you want.

Change the 7 in the part that says 7 * 3600 to the hour in the day you want it to switch, in your case 7am/7pm.


This will cause the file name to be stamped with the date, then AM or PM.  It will say AM from 7am to 7pm, and PM from 7pm to 7am.


This works in US locales.  What it does in other locales I cannot say, as it depends on how AM/PM is represented in that locale (country). 

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.