Recent

Author Topic: Date format set to mm-dd-yyyy  (Read 36134 times)

freddynerk

  • Jr. Member
  • **
  • Posts: 96
Date format set to mm-dd-yyyy
« on: June 01, 2010, 11:48:23 pm »
Hi all,
I have an application which uses TdateEdit.
I live in Australia which uses dd-mm-yyyy but
the program reverts back to the US way of formatting.
I have set ShortDateFormat := 'dd-mm-yyyy' but
the format is still in the US way.
Any ideas on what else I need to check.
I am using 9.29 (from daily snapshot 1/6/10
FPC 2.4.0
SVN 21827M
i386-darwin-carbon (beta)

Tom

exdatis

  • Hero Member
  • *****
  • Posts: 668
    • exdatis
Re: Date format set to mm-dd-yyyy
« Reply #1 on: June 02, 2010, 12:30:56 am »
Use ZVDateTimeControls Package (by Zoran Vucenovic), excellent compon.
Set DateDisplayOrder to ddoDMY.
In db_fields set DisplayFormat to DD-MM-YYYY.
« Last Edit: June 02, 2010, 12:50:37 am by exdatis »

freddynerk

  • Jr. Member
  • **
  • Posts: 96
Re: Date format set to mm-dd-yyyy
« Reply #2 on: June 03, 2010, 10:53:51 pm »
Hi All,
I installed ZVDateTimeControls.
Lazarus freezes when you try to place the TdateTimePicker on a form.
Any other ideas anyone.
All I need is Day - Month - Year

Tom

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Date format set to mm-dd-yyyy
« Reply #3 on: June 03, 2010, 11:01:55 pm »
Are you sure that your system is not a US configured system? I am from Brazil, which uses day-month-year and here it is OK.

I use Windows.
« Last Edit: June 03, 2010, 11:07:57 pm by typo »

freddynerk

  • Jr. Member
  • **
  • Posts: 96
Re: Date format set to mm-dd-yyyy
« Reply #4 on: June 03, 2010, 11:09:27 pm »
I got my Mac in Australia, which uses Day - Month - Year.
The date is correct in all other mac programs.
Do I need to set anything else. I am not a Mac user.
(Accept for writing some programs for friends in Lazarus)

Tom

freddynerk

  • Jr. Member
  • **
  • Posts: 96
Re: Date format set to mm-dd-yyyy
« Reply #5 on: June 03, 2010, 11:10:58 pm »
I got my Mac in Australia, which uses Day - Month - Year.
The date is correct in all other mac programs.
Do I need to set anything else. I am not a Mac user.
(Accept for writing some programs for friends in Lazarus)

Tom

Zoran

  • Hero Member
  • *****
  • Posts: 1824
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Date format set to mm-dd-yyyy
« Reply #6 on: June 04, 2010, 02:21:37 am »
Hi All,
I installed ZVDateTimeControls.
Lazarus freezes when you try to place the TdateTimePicker on a form.

Freezes on Mac?  :(
It works well on Linux and Windows -- tested with widgetsets Win32, Gtk2 and Qt.
I have no way to test it on Mac, I'm sorry if it doesn't work there.

Any other ideas anyone.
All I need is Day - Month - Year

Tom

DateEdit control has DateOrder property. Did you set it?

IndianaJones

  • Hero Member
  • *****
  • Posts: 509
Re: Date format set to mm-dd-yyyy
« Reply #7 on: June 04, 2010, 03:40:57 am »

What is your International settings, you can change the order of the date format with drag and drop event? (In the International/Formats/Customize)
Thanks.

driainanderson

  • Newbie
  • Posts: 1
Re: Date format set to mm-dd-yyyy
« Reply #8 on: February 27, 2012, 03:30:04 pm »
I may be too late, but I included the following code in the initallization section of Form1 and lo, dates the way I am used to.


initialization
  DateSeparator := '.';
  ShortDateFormat := 'd.m.yy';
  LongDateFormat := 'd. mmmm yyyy';       

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Date format set to mm-dd-yyyy
« Reply #9 on: February 28, 2012, 03:38:27 am »
Even if it is late it is a valuable suggestion.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Date format set to mm-dd-yyyy
« Reply #10 on: February 28, 2012, 03:50:59 am »
Even if it is late it is a valuable suggestion.

Those globals are all deprecated. Use NSFormat.pas unit as described here:

https://forums.embarcadero.com/thread.jspa?threadID=67343&tstart=0

Requires FPC 2.6.0 - works with both OS X and iOS.

Thanks.

-Phil

Zoran

  • Hero Member
  • *****
  • Posts: 1824
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Date format set to mm-dd-yyyy
« Reply #11 on: February 28, 2012, 08:14:32 am »
Even if it is late it is a valuable suggestion.

Those globals are all deprecated. Use NSFormat.pas unit as described here:

https://forums.embarcadero.com/thread.jspa?threadID=67343&tstart=0

Requires FPC 2.6.0 - works with both OS X and iOS.

Thanks.

-Phil

This is also a valuable information, but its purpose is quite opposite, use it when you want to pick the settings from user's OS. If your intention is to use what you want instead of OS's settings (and this seems to be the case here), then you should do what drainanderson suggested.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Date format set to mm-dd-yyyy
« Reply #12 on: February 28, 2012, 03:29:07 pm »

This is also a valuable information, but its purpose is quite opposite, use it when you want to pick the settings from user's OS. If your intention is to use what you want instead of OS's settings (and this seems to be the case here), then you should do what drainanderson suggested.

Point is you should not use the deprecated globals - use a TFormatSettings record instead with the overloaded formatting functions. How you populate TFormatSettings is up to you - if you want to use the user's locale or the user's Preferences, then the NSFormat unit is your only choice currently.

Thanks.

-Phil

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Date format set to mm-dd-yyyy
« Reply #13 on: June 10, 2014, 01:37:40 am »
Even if it is late it is a valuable suggestion.

Those globals are all deprecated. Use NSFormat.pas unit as described here:

https://forums.embarcadero.com/thread.jspa?threadID=67343&tstart=0

Requires FPC 2.6.0 - works with both OS X and iOS.

Thanks.

-Phil

To reopen this old issue: Where can we get the NSFormat.pas unit today? The web.me.com address provided in the Embarcadero forum seems to be no longer available.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Date format set to mm-dd-yyyy
« Reply #14 on: August 14, 2014, 12:20:35 am »
After hours of research I found a more flexible solution that automatically accounts for the "International" settings of systems preferences. I have posted it in the wiki at http://wiki.lazarus.freepascal.org/OS_X_Programming_Tips#Date_format.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

 

TinyPortal © 2005-2018