Differences
This shows you the differences between the selected revisions of the page.
2016-05-30 | 2016-06-22 | ||
non isolated script is not portable (martin) | 5.8.4 The %TIMESTAMP% syntax allows formatting time strings for a time relative to present time (martin) | ||
Line 66: | Line 66: | ||
==== Timestamp ==== | ==== Timestamp ==== | ||
- | WinSCP automatically resolves ''%TIMESTAMP%'' to a real time with format ''20141024161712''.((Unless the ''%TIMESTAMP%'' variable is already set in an environment, when WinSCP is started.)) | + | WinSCP automatically resolves ''%TIMESTAMP[rel]#format%'' to a real time (optionally to a past or future time) with the given format. The ''format'' may include ''yyyy'' for year, ''mm'' for month, ''dd'' for day, ''hh'' for hour, ''nn'' for minute and ''ss'' for second. For example, the ''%TIMESTAMP#yyyy-mm-dd%'' resolves to ''2016-06-22'' on 22 June 2016. See [[http://docwiki.embarcadero.com/Libraries/XE6/en/System.SysUtils.FormatDateTime|other formats you can use]]. |
- | You can customize the format using syntax ''%TIMESTAMP#format%'' where ''format'' may include ''yyyy'' for year, ''mm'' for month, ''dd'' for day, ''hh'' for hour, ''nn'' for minute and ''ss'' for second. For example ''%TIMESTAMP#yyyy-mm-dd%'' resolves to ''2014-10-24''.((Syntax ''%TIMESTAMP#format%'' is resolved by WinSCP to a real time, even if ''%TIMESTAMP%'' variable is already set in environment, when WinSCP is started.)) See [[http://docwiki.embarcadero.com/Libraries/XE6/en/System.SysUtils.FormatDateTime|other formats you can use]]. | + | The optional ''rel'' part, with syntax ''[-+]time[YDHNS]'', produces past (''-'') or future (''+'') timestamps. One of the following units must be used: ''Y'' (years), ''D'' (days), ''H'' (hours), ''N'' (minutes) or ''S'' (seconds). For example, the ''%TIMESTAMP-1D#yyyy-mm-dd%'' resolves to ''2016-06-21'' on 22 June 2016. &beta_feature |
- | To use ''%TIMESTAMP%'' on command-line in a batch file, you need to escape the ''%'' by doubling it to ''<nowiki>%%TIMESTAMP%%</nowiki>'', to avoid batch file interpreter trying to resolve the variable. | + | To use ''%TIMESTAMP%'' on a command-line in a batch file, you need to escape the ''%'' by doubling it to ''<nowiki>%%TIMESTAMP%%</nowiki>'', to avoid a batch file interpreter trying to resolve the variable. |
==== [[arguments]] Script Arguments ==== | ==== [[arguments]] Script Arguments ==== |