When you want to get the current day and time, you can use the Date Time Now tool or the DateTimeNow() function on the Formula tool. Although it may be difficult to notice, there is actually a difference between those tools.
What is the Date Time Now tool?
The Date Time Now tool is to get the current day and time in the In/Out category. Actually, it’s a macro and the setting is very simple which is to set the language and select the format. After then, it outputs only one record which contains current day and time by text type format.
The setting is as follows.
The output is as follows.
What is the DateTimeNow() function?
The DateTimeNow() function is the function to get the current date and time for any Formula tools. For example, you can use it as follow.
What is the difference?
The DateTimeNow() function and the Date Time Now tool look the same, but what’s the difference?
Let’s see a specific case. When you want to add the current date and time to the file name, you make the field which contains the date and time field and use the option “Take File/Table Name From Field” and set that field to that option on the Output Data tool.
For creating this DateTimeNow field, compare the way by the DateTimeNow() function and the Date Time Now tool. In this case, I add the Throttle tool to simulate the huge data handling. The workflow is as follows.
Note that the Throttle tool is only for E1 Engine.
After run, you can see the logs in the Results window.
This means that some multiple files are output by DateTimeNow() function. Let’s see it more deeply.
The result of the DateTimeNow() function is as follows. This means that the DateTimeNow() function generate the date and time when each records is processed. However this is not what you expect.
On the other hands, the Date Time Now function tool’s result is as follows. This date and time are all the same because the Date Time Now tool output one record and the Field Append tool add it.
If you use the DateTimeNow() function in the workflow which proceed the little data, it is difficult to find this behavior. But when you handle huge data, it will be reveal.
Conclusion
- The Date Time Now tool create only one record, but the DateTimeNow() function generates the date and time at which each record passed.
- When you use the date and time as file name, use the Date Time Now tool.
Sample Workflow Download
The Next Blog Post is…
How to calculate and change field type at the same time.
コメント