1.41 FAQ-157 How do I add a date time stamp to my graph?
Last Update: 3/8/2021
- To add the current date and time to the top of your graph window, click the Date & Time button (docked, by default, to the lower-left side of your Origin workspace). If you don't see this button, choose (View:Toolbars) and enable the Add Object to Graph toolbar.
- To delete the stamp, click on the stamp to select it and press DELETE.
The Date & Time stamp is a static text object. To format the stamp:
- Click on the stamp to select it (certain Format toolbar buttons require you to double-click to enter "in-place" editing mode).
- Use Format toolbar buttons or Mini Toolbar buttons for text label editing, to format timestamp text.
Modifying the stamp in Origin 2021b and later
Starting with Origin 2021b, clicking the Date & Time button opens a small Date & Time dialog:
- Pick a Format from the list and click OK.
- Optionally, click Set as Default.
Note that only one timestamp object can be added to a given window. If you change your mind on the displayed format, delete the timestamp and start over.
If you modified your Date & Time stamp format in an earlier version of Origin, you would have saved it to a file called Standard.ogs in User Files (UFF). You can either (a) continue to edit that file (see the next section) or (b) if you are sure you don't need any other custom scripts in that Standard.ogs file, you can delete it and use the newer method of timestamp customization.
Modifying the stamp in Origin 2021 and earlier
By default, the Date & Time stamp adds date-time in the following format:
M/d/yyyy HH:mm:ss // e.g. 3/4/2021 15:19:58
When clicked on, the Date & Time button runs a line of script in the [DateTime] section of the STANDARD.OGS file located in your Origin folder. That line of script reads like one of the following:
label -s -sa -dc (dXFactor*page.width) (dYFactor*page.height) -n timestamp $(@D,D10); // 2019b and earlier
label -mg -s -sa -dc (dXFactor*page.width) (dYFactor*page.height) -n timestamp $(@D,D10); // changed v2020
The $(@D,D10) portion of this script specifies date/time format. This corresponds to the 11th format in the Origin Date Display list (count starts at zero so (D10) = 11th in list). To see the list, open the Properties dialog for any worksheet column, set Format to Date, then click on the Display drop-down. Remember to count down the list starting with zero (0).
When you know the index number of the date format that you want:
- Open the file STANDARD.OGS in a text editor.
- Locate the [DateTime] section.
- Locate the line of script mentioned above.
- Change D10 to Dn where n is the nth item in Display drop-down list, starting with n = 0.
- Save the modified OGS file to \User Files (UFF).
- Click the Date & Time button to display your modified format.
If you need a format that is not in the standard list, you can define two Custom Date Formats on the Miscellaneous tab of your Options dialog (Tools: Options or Preferences: Options) and they will show at the bottom of the Display list.
Keywords:date, time, stamp, timestamp, customize graph, add date and time, time stamp, add stamp, Standard.ogs