Tuesday, October 03, 2006

Add date and time to your log file automatically

One common use for Notepad is creating log files or journal files. For example, assume you need to keep track of events that happen during the day, noting the date and time of each event. You could use an application such as Outlook's Journal folder to track events, but perhaps that’s overkill for your situation. All you want to do is open a text file, insert the current date and time, write a few notes, and close the file.

You can easily insert the current time and date into Notepad manually. Just open Notepad and press [F5] or choose Edit | Time/Date. But Notepad also offers a third option that inserts the time and date automatically when you open the file.

Create a blank text file with .LOG as the first line of the file, followed by a carriage return, and then save and close the file.
Double-click the file to open it and notice that Notepad appends the current date and time to the end of the file and places the cursor on the line after.
Type your notes and then save and close the file.
Each time you open the file, Notepad repeats the process, appending the time and date to the end of the file and placing the cursor below it.

No comments:

Databases and Data Visualisations Course for kids Week 1

As mentioned last week, I have started the Databases and Data Visualisations course for kids aged between 11 to 15 years yesterday. It was...