Util.DayOfWeek

Top  Previous  Next

 

Syntax

function Util.DayOfWeek(DateValue: datetime): integer

 

Alternative Names

ibec_DayOfWeek

 

Description

Returns the day of the week for a specified date.

 

The Return Value is the day of the week of the specified date as an integer between 1 and 7, where Sunday is the first day of the week and Saturday is the seventh.

 

See Also

Util.Date

 

Example

execute UDSBlock

as

declare dtvalue timestamp;

begin

  /* get day number from todays date */

  daynr = Util.DayOfWeek(Util.Date());

  GUI.ShowMessage('It''s day ' || daynr || ' of this week.');

  

  /* init variables in order to create them implicitly, required for the routine calling */

  y = 0;

  d = 0;

  m = 0;

  

  h = 0;

  n = 0;

  s = 0;

  ms = 0;

  

  /* encode/decode date and time values */

  dtvalue = Util.EncodeDateTime(2023, 12, 5, 13, 12, 11, 10);

  Util.DecodeDateTime(dtvalue, y, d, m, h, n, s, ms);

  

  dtvalue = Util.EncodeDate(2022, 11, 4);

  Util.DecodeDate(dtvalue, y, d, m);

  

  dtvalue = Util.EncodeTime(12, 11, 10, 9);

  Util.DecodeTime(dtvalue, h, n, s, ms);

  

end