* * *

Author Topic: Date Format  (Read 812 times)

Stag76

  • New member
  • *
  • Posts: 22
Date Format
« on: June 27, 2012, 04:30:44 am »
I have 2 laptops running Win7 Professional and Lazarus Version V0.9.30. One Accepts the input to StrtoDateTime in the format '30/06/2011', while the other needs it in the format '06/30/3011'. Both laptops have identical Date Format Settings.
Is there a setting I have missed?

taazz

  • Hero Member
  • *****
  • Posts: 734
Re: Date Format
« Reply #1 on: June 27, 2012, 05:50:43 am »
I'm not sure about this dont have the time to test it my self but there are some global format settings in the sysutils unit specificaly yoy should check the shortDateformat, longdateformat and DefaultformatSettings variables.

I'd like to think that they play a role on the lcl controls when ever a date is to be converted from text to datetime and vice versa.

regards
OS : Windows 7 32 bit or Windows XP 32 bits
Laz: Lazarus 1.0.6 r40119 FPC 2.6.2 i386-win32-win32/win64
INDY:10.5.8.0...
VTV : 4.8.6 with Extras.

Stag76

  • New member
  • *
  • Posts: 22
Re: Date Format
« Reply #2 on: June 27, 2012, 07:40:38 am »
Thanks for that.

How do you access the ShortDateFormat variable?

taazz

  • Hero Member
  • *****
  • Posts: 734
Re: Date Format
« Reply #3 on: June 27, 2012, 08:27:09 am »
Thanks for that.

How do you access the ShortDateFormat variable?
Code: [Select]
Unit XXXXXXX;

Interface
  uses Sysutils;
..
..
..
procedure SetShortDateFormatDDMMYYYY;
Implementation
//uses sysutils; //or here not both

procedure SetShortDateFormatDDMMYYYY;
begin
  sysutils.DefaultFormatSettings.ShortDateFormat:= 'DD/MM/YYYYY';
end;


Thats the only thing you should have to do. after that all the datetime routines that convert between TDateTime and Text should use this setting including the display in DB grids and datetime pickers.
OS : Windows 7 32 bit or Windows XP 32 bits
Laz: Lazarus 1.0.6 r40119 FPC 2.6.2 i386-win32-win32/win64
INDY:10.5.8.0...
VTV : 4.8.6 with Extras.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads