<< back to sysax.com Product page

13.2. Creating a formatted timestamp

The formattimestamp method can be used to generate timestamps in multiple formats, arranged in different ways like MM/DD/YYYY or MM-DD-YY. The method takes a timestamp format string as input and generates the corresponding timestamp. An existing timestamp in the default YYYYMMDDhhyyss format that was previously generated using the GetTimestamp method can also be passed as an input to this method. If no timestamp is passed in, the current timestamp value is automatically generated and used.

The following values in the format string are replaced with the corresponding timestamp values:

%YYYY% - replaced by the 4 digit year

%YY% - replaced by the 2 digit year

%MM% - replaced by the 2 digit month

%DD% - replaced by the 2 digit day

%hh% - replaced by the 2 digit hour

%mm% - replaced by the 2 digit minute

%ss% - replaced by the 2 digit second

Exhibit 13.3. IDL Definition of method to creating a formatted timestamp



HRESULT FormatTimestamp ([in] BSTR b_formatstring, [in, defaultvalue("")] BSTR b_intimestamp, [out, retval, defaultvalue(NULL)] BSTR *b_timestampout);


Exhibit 13.4. Example usage of method to creating a formatted timestamp (VBScript)


Dim ts
ts = app.FormatTimestamp "%YYYY%", ""