Function to obtain the value of the month of the current year from the date/time value.

 

Syntax

function MonthOf(dt: double): integer;

 

Parameters and return values

Parameter

Type

Value

dt

double

date/time value from which you need to get the numeric value of the month.

 

Function result

Returns the month of the year, value from 1 though 12.

 

Example


var
  iMonth: integer;
  s: string;
begin
  iMonth := MonthOf(Now);
  
    case iMonth of
      1: s := 'Enero';
      2: s := 'Febrero';
      3: s := 'Marzo';
      4: s := 'Abril';
      5: s := 'Mayo';
      6: s := 'Junio';
      7: s := 'Julio';
      8: s := 'Agosto';
      9: s := 'Septiembre';
      10: s := 'Octubre';
      11: s := 'Noviembre';
      12: s := 'Diciembre';
    end;  
  mLogScript('Current month is (in Spanish): ' + s, '');
end.


Script work result

[21:56:21] (Log "MonthOf"): Current month is (in Spanish): Noviembre

[21:56:21] (Run "MonthOf"): Script operation time: 2 ms

[21:56:21] (Run "MonthOf"): Script done successfully...

 

See also

mLogScript

Now