Differences

This shows you the differences between the selected revisions of the page.

script_formatting_timestamp_batch_file 2017-10-16 script_formatting_timestamp_batch_file 2023-04-24 (current)
Line 7: Line 7:
The ''%TIMESTAMP%'' syntax can be used as: The ''%TIMESTAMP%'' syntax can be used as:
-  * A locale-independent alternative to the ''date'' command/variable; ((The ''date'' command/variable uses locale-specific format, so common syntax like ''%%%date~...%%%'' yields expected ''%%yyyymmdd...%%'' value on US-locale only.))+  * A locale-independent alternative to the ''date'' command/variable; ((The ''date'' command/variable uses locale-specific format, so common syntax like ''<nowiki>%date:~10,4%%date:~4,2%%date:~7,2%</nowiki>'' yields expected ''%%yyyymmdd%%'' value on US-locale only.))
  * An easy way to calculate relative times, like yesterday date, tomorrow date, time one hour ago, etc.   * An easy way to calculate relative times, like yesterday date, tomorrow date, time one hour ago, etc.
Line 35: Line 35:
</code> </code>
-===== Calculating Relative Times =====+===== [[relative]] Calculating Relative Times =====
To calculate relative times, you can extend the batch file like below. The script will print the yesterday date. To calculate relative times, you can extend the batch file like below. The script will print the yesterday date.
Line 67: Line 67:
</code> </code>
-To calculate relative times, use methods of the ''[[https://msdn.microsoft.com/en-us/library/system.datetime.aspx|DateTime]]'' class, like the ''[[https://msdn.microsoft.com/en-us/library/system.datetime.adddays.aspx|AddDays]]''. To format the calculated timestamp, use the ''[[https://msdn.microsoft.com/en-us/library/zdtaw1bw.aspx|ToString]]'' method.+To calculate relative times, use methods of the ''[[dotnet&gt;system.datetime|DateTime]]'' class, like the ''[[dotnet&gt;system.datetime.adddays|AddDays]]''. To format the calculated timestamp, use the ''[[dotnet&gt;system.datetime.tostring#system-datetime-tostring(system-string)|ToString]]'' method.
<code powershell> <code powershell>

Last modified: by martin