Recent

Author Topic: ShortDayNames replacement  (Read 2733 times)

Winch

  • New Member
  • *
  • Posts: 22
ShortDayNames replacement
« on: November 16, 2017, 03:56:55 pm »
My compiler says that ShortDayNames and ShortMonthNames are deprecated. What should I be using instead. Googling only seems to bring up the old names.

I am running Windows 10

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: ShortDayNames replacement
« Reply #1 on: November 16, 2017, 04:16:58 pm »
Use it as DefaultFormatSettings.ShortDayNames etc
https://www.freepascal.org/docs-html/rtl/sysutils/tformatsettings.html

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: ShortDayNames replacement
« Reply #2 on: November 16, 2017, 04:18:07 pm »
A quick glance on the documentation of ShortDayNames reveals:
Quote
This constant is deprecated. You should use DefaultFormatSettings.ShortDayNames instead.

... and the same for ShortMonthNames reveals:
Quote
This constant is deprecated. You should use DefaultFormatSettings.ShortMonthNames instead.

Winch

  • New Member
  • *
  • Posts: 22
Re: ShortDayNames replacement
« Reply #3 on: November 16, 2017, 04:22:38 pm »
Many thanks zeljko and molly.

That's very clear, albeit a bit of a mouthful!

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: ShortDayNames replacement
« Reply #4 on: November 16, 2017, 04:37:19 pm »
...albeit a bit of a mouthful!
In case of a cold dark winter-day:  :)
Code: [Select]
program test;

{$MODE OBJFPC}{$H+}

uses
  SysUtils;

var
  DF : TFormatSettings absolute  SysUtils.DefaultFormatSettings;
  S  : String;

begin
  with DF do
    for s in ShortMonthNames do WriteLn(S);
end.
« Last Edit: November 16, 2017, 04:45:21 pm by molly »

Winch

  • New Member
  • *
  • Posts: 22
Re: ShortDayNames replacement
« Reply #5 on: November 16, 2017, 04:56:19 pm »
Again thanks Molly.

I think I will just use the DefaultFormatSettings expression, as it's clear and will remove those annoying compiler messages and once done it won't matter that its a mouthful.

 

TinyPortal © 2005-2018