Search code examples
inno-setuputcgmt

How can I form an Inno Setup OutputBaseFilename that includes UTC time


I'm trying to build an output filename that includes UTC time rather than local time.

I start with this...

#define MyDateTimeString GetDateTimeString('yyyy/mm/dd/hh', '-', ':')

Then I have this...

OutputBaseFilename=MyProgramName-{#MyDateTimeString}-Setup

That creates an output file like...

MyProgramName-2023-10-01-15-Setup.exe

But I want the hours to be in UTC, not in local time. Is there a way to do that? (I'm pretty inexperienced in Inno Setup, so please be specific if you have an example)


Solution

  • I do not think that you can do it with built-in Inno Setup functionality. You would have to use an external tool.

    It's easy for example with PowerShell:
    Powershell simplest method to get current time expressed as UTC

    There are many question here that show how to call PowerShell from the Inno Setup preprocessor and use the data the PowerShell "calculates" back in the Inno Setup script.

    Two random examples: