I am using curl to interact with the REST API of JetBrains’ YouTrack issue tracker from the Windows command line. It is a very simple process that uses no other utility than curl (built as a single windows executable). I’d like to keep the simplicity, but I have run into an issue. One of the API’s wants me to pass a Unix timestamp, but there is no Windows utility to generate one. I suppose it would be simple enough to write a utility myself, but I’d prefer not to reinvent the wheel.
The API I am calling is here:
http://confluence.jetbrains.net/display/YTD3/PUT+Version
And I am looking to populate the “releaseDate” field.
Is there a utility to generate the Unix timestamp on windows that is self contained, ie I don’t need to install cygwin or something huge like that.
EDIT: For the record here is what I ended up doing (its part of a *.bat file):
type nul >pcmd.ps1
echo $timestamp=Get-Date -UFormat '%%s' >>pcmd.ps1
echo $timestamp=[Math]::Truncate($timestamp) >> pcmd.ps1
echo curl "http://myserver/rest/admin?releaseDate=$timestamp&isReleased=true" -v -b yt --upload-file empty >>pcmd.ps1
type pcmd.ps1
powershell - <pcmd.ps1
with native MS powershell this may work:
http://technet.microsoft.com/en-us/library/dd347647.aspx