tags:

views:

16

answers:

1

Please let me know How to get Local DateTime in InnoSetup?

A: 

The answer depends on when you need it.

  • Needed at the time the setup is built
  • Needed at the time of install.

Needed at the time the setup is built.

You will need to use ISPP which is part of the Quick Start pack.

You can use the str GetDateTimeString(str, str, str) function.

Example: #define MyDateTimeString GetDateTimeString('dd/mm/yyyy hh:nn:ss', '-', ':');

The help menu in ISTool (Also a part of the Quick Start Pack) has a good help file for ISPP functions including this one where there is a page of information on this function.

Needed at the time of install.

You can get this value in a Pascal Script by using the NOW() function if you need it as a String your can use the Now function.

The following TDateTime Functions are available in the pascal script:

function EncodeDate(Year, Month, Day: Word): TDateTime;
function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;
function TryEncodeDate(Year, Month, Day: Word; var Date: TDateTime): Boolean;
function TryEncodeTime(Hour, Min, Sec, MSec: Word; var Time: TDateTime): Boolean;
procedure DecodeDate(const DateTime: TDateTime; var Year, Month, Day: Word);
procedure DecodeTime(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word);
function DayOfWeek(const DateTime: TDateTime): Word;
function Date: TDateTime;
function Time: TDateTime;
function Now: TDateTime;
function DateTimeToUnix(D: TDateTime): Int64;
function UnixToDateTime(U: Int64): TDateTime;

function DateToStr(D: TDateTime): String;
function StrToDate(const s: String): TDateTime;
function FormatDateTime(const fmt: String; D: TDateTime): String;
Robert Love