iNTERFACEWARE Products Manual > Installing and Using Chameleon > Using Python Scripting > Python Scripting Examples > Date and Time Manipulation > Generating Timestamps that Include Milliseconds |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
Suppose that you want a timestamp that includes milliseconds of a second (e.g. YYYYMMDD HH:MM:SS.SSS). Since it is not possible to get milliseconds when using time.strftime(), you must extract the milliseconds from the value returned by time(). For example:
This code produces timestamps such as 20080610152447302. This script defines a function that can be used as needed. It should be placed in the Global Outbound Preprocess Script (for generating messages), or the Global Inbound Script (for parsing messages). When you want to use the script, you call it by placing the following code in the appropriate segment or table level script:
|