Board index » delphi » Date formatted 'dd/mm/yyyy'

Date formatted 'dd/mm/yyyy'

Set property TField.DisplayFormat = 'dd/mm/yyyy'
 

Re:Date formatted 'dd/mm/yyyy'


Hi...

How to setup all date data (Tfield, Date) in Application with format like
'dd/mm/yyyy' ?

Thanks

Re:Date formatted 'dd/mm/yyyy'


I put mine in project after the creation but before the 'run' but also could
be in a unit.

ShortDateFormat := 'm/d/yyyy';

Quote
Felik Harmanto wrote:
> Hi...

> How to setup all date data (Tfield, Date) in Application with format like
> 'dd/mm/yyyy' ?

> Thanks

Re:Date formatted 'dd/mm/yyyy'


thanks.

But.... how about function Date? where should I formatted it?

Quote
John Herbster <herb-...@swbell.net> wrote in message

news:38fd16aa$1@dnews...
Quote
> Set property TField.DisplayFormat = 'dd/mm/yyyy'

Re:Date formatted 'dd/mm/yyyy'


thanks,

I've tried it like you sad, but when I compile my project I got error
message "Undeclared identifier: "LongDateFormat""

thanks .

Quote
kenneth thompson <kenneth.l.thomp...@worldnet.att.net> wrote in message

news:38FD3755.609B51CB@worldnet.att.net...
Quote
> I put mine in project after the creation but before the 'run' but also
could
> be in a unit.

> ShortDateFormat := 'm/d/yyyy';

> Felik Harmanto wrote:

> > Hi...

> > How to setup all date data (Tfield, Date) in Application with format
like
> > 'dd/mm/yyyy' ?

> > Thanks

Re:Date formatted 'dd/mm/yyyy'


On Wed, 19 Apr 2000 12:26:16 +0700, "Felik Harmanto"

Quote
<felikharma...@yahoo.com> wrote:
>I've tried it like you sad, but when I compile my project I got error
>message "Undeclared identifier: "LongDateFormat""

The Delphi help file says it's defined in SysUtils.  You have to
include that in your uses list.

Jan

Re:Date formatted 'dd/mm/yyyy'


Thanks...

I did what you sad to do. But when I use Date function in my report using
Quick Report,
the date format still 'mm/dd/yy' and also every control (TDBEdit with date
data) in my form when I edit, the format still 'mm/dd/yy'.

Is it possible to make TDBEdit control in mode editing be formatted like
'dd/mm/yyyy'?
So... please tell me how to make a DEFAULT format for date in all
APPLICATION?

Thanks

Quote
Jan Sprengers <j...@nospamplease.adm2000.be> wrote in message

news:38fd5808.319461351@forums.inprise.com...
Quote
> On Wed, 19 Apr 2000 12:26:16 +0700, "Felik Harmanto"
> <felikharma...@yahoo.com> wrote:

> >I've tried it like you sad, but when I compile my project I got error
> >message "Undeclared identifier: "LongDateFormat""

> The Delphi help file says it's defined in SysUtils.  You have to
> include that in your uses list.

> Jan

Re:Date formatted 'dd/mm/yyyy'


On Wed, 19 Apr 2000 18:17:05 +0700, "Felik Harmanto"

Quote
<felikharma...@yahoo.com> wrote:
>I did what you sad to do. But when I use Date function in my report using
>Quick Report,
>the date format still 'mm/dd/yy' and also every control (TDBEdit with date
>data) in my form when I edit, the format still 'mm/dd/yy'.

>Is it possible to make TDBEdit control in mode editing be formatted like
>'dd/mm/yyyy'?

>So... please tell me how to make a DEFAULT format for date in all
>APPLICATION?

Re-reading the previous messages it sounds like you changed the
LongDateFormat instead of the ShortDateFormat like you were told to.

To change the date format for all Windows applications, together with
your running application, use:

      ShortDateFormat := 'dd/mm/yyyy';
      SetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE,
        PChar(ShortDateFormat));

HTH,

Jan

Re:Date formatted 'dd/mm/yyyy'


Quote
>Felik Harmanto wrote:

>I did what you sad to do. But when I use Date function in my report >using Quick Report, the date format still 'mm/dd/yy' and also every >control (TDBEdit with date data) in my form when I edit, the format >still 'mm/dd/yy'.
>Is it possible to make TDBEdit control in mode editing be formatted >like 'dd/mm/yyyy'?

Kenneth gave you the solution (but you tried 'LongDateFormat' instead,
see your previous post).

Add SysUtils to the uses clause.

Put this e.g. into the FormCreate event:

  ShortDateFormat := 'dd/mm/yyyy';

________
Andreas
Delphi 5.01 Pro, WinNT4.0 Sp5

Re:Date formatted 'dd/mm/yyyy'


I've tried using ShortDateFormat, LongDateFormat and it stiil not change.

When I create report using QuickReport 3.0.5, Date funtion that I used as
expression (using TQRExpr component & set it's expression property to Date)
still formatted 'mm/dd/yy'.
And I just change date format only in my application not all windows
application.(not using regional setting on control panel)

I used to create program using foxpro. When I want to change date format
from 'mm/dd/yyyy' to 'dd/mm/yyyy'
I just using 'SET DATE TO BRITISH' command.
And all program will use date format like 'dd/mm/yyyy'

Please help me?

Thanks anyway.

Quote
Jan Sprengers <j...@nospamplease.adm2000.be> wrote in message

news:38fdb21c.342520868@forums.inprise.com...
Quote
> On Wed, 19 Apr 2000 18:17:05 +0700, "Felik Harmanto"
> <felikharma...@yahoo.com> wrote:

> >I did what you sad to do. But when I use Date function in my report using
> >Quick Report,
> >the date format still 'mm/dd/yy' and also every control (TDBEdit with
date
> >data) in my form when I edit, the format still 'mm/dd/yy'.

> >Is it possible to make TDBEdit control in mode editing be formatted like
> >'dd/mm/yyyy'?

> >So... please tell me how to make a DEFAULT format for date in all
> >APPLICATION?

> Re-reading the previous messages it sounds like you changed the
> LongDateFormat instead of the ShortDateFormat like you were told to.

> To change the date format for all Windows applications, together with
> your running application, use:

>       ShortDateFormat := 'dd/mm/yyyy';
>       SetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE,
>         PChar(ShortDateFormat));

> HTH,

> Jan

Re:Date formatted 'dd/mm/yyyy'


On Thu, 20 Apr 2000 08:00:03 +0700, "Felik Harmanto"

Quote
<felikharma...@yahoo.com> wrote:
>I've tried using ShortDateFormat, LongDateFormat and it stiil not change.

>When I create report using QuickReport 3.0.5, Date funtion that I used as
>expression (using TQRExpr component & set it's expression property to Date)
>still formatted 'mm/dd/yy'.

I've never used QR, so I'm scating on very thin ice here:

A quick peek in the help file reveals that you should use the
TQRExpr.Mask property to give the date format.  If you don't it looks
like QR is using the Windows settings instead of Delphi's
ShortDateFormat.

I can't be sure that it will effectively work though...

Jan

Re:Date formatted 'dd/mm/yyyy'


I have followed this thread for a while and am still puzzled with your
problem or what you are trying to do, which is probably because I'm
not a native english speaker, but here goes another try, essentially
another way of telling what has already been said.

If you want the dateformat to be changed in something you like more
for the lifetime of your application, just set it before it has to
apply; the mainform's create handler would be a good place for that.
ShortDateFormat and the like are global to the application.

If you REALLY want to change the system settings so it applies to all
other programs on a user's HD, you'd use some of the Windows api
functions like this:
  procedure ChangeSystemShortDate;
  var
    LocaleID : cardinal;
  begin
    LocaleID := GetSystemDefaultLangID;
    SetLocaleInfo(LocaleID,LOCALE_SSHORTDATE,'mm/yyyy/dd/yyyyddmm');
    ShortDateFormat := 'mm/yyyy/dd/yyyyddmm';
  end;
Setting ShortDateFormat nevertheless here is because your app will
only see the system wide change when it is restarted: in fact,
SetLocaleInfo writes to the registry... Of course, 'for real', you
would provide the picture as a parameter to the procedure to avoid
typos in both settings...

Now, seriously, I would think that over more than once: suppose every
programmer does that to implement his own flavor... Like the
idiosyncratic one above. Whichever comes last wins. More than
probably, that will be the user. After all, these are his preferences!
So, as soon as he discovers the mess, he'll be wishing you to hell and
change it back to his own settings, albeit using the control panel or
regedit. I would! Well, I wouldn't use an application doing this kind
of stuff if I can help it.

What would make (a little) more sense is changing the format just for
the lifetime of that report, so it complies to corporate policies, for
instance (although it can be said that preferences are PERSONAL, so
it's his responsability to comply or not). If that's what you want,
you should code something like the following OnClick handler of some
button:
  procedure TForm1.Button1Click(Sender: TObject);
  var
    OldDateFormat : string;
  begin
    OldDateFormat := ShortDateFormat;  // save settings
    ShortDateFormat := 'dd/mm/yyyy';
    with TForm2.Create(Self) do
      try
        QuickRep1.Preview;
      finally
        Free;
      end;
    ShortDateFormat := OldDateFormat; // restore them
  end;

Hope it helps.

Jasper D.

On Thu, 20 Apr 2000 08:00:03 +0700, "Felik Harmanto"

Quote
<felikharma...@yahoo.com> wrote:
>I've tried using ShortDateFormat, LongDateFormat and it stiil not change.

>When I create report using QuickReport 3.0.5, Date funtion that I used as
>expression (using TQRExpr component & set it's expression property to Date)
>still formatted 'mm/dd/yy'.

>And I just change date format only in my application not all windows
>application.(not using regional setting on control panel)

>I used to create program using foxpro. When I want to change date format
>from 'mm/dd/yyyy' to 'dd/mm/yyyy'
>I just using 'SET DATE TO BRITISH' command.
>And all program will use date format like 'dd/mm/yyyy'

>Please help me?

>Thanks anyway.

>Jan Sprengers <j...@nospamplease.adm2000.be> wrote in message
>news:38fdb21c.342520868@forums.inprise.com...
>> On Wed, 19 Apr 2000 18:17:05 +0700, "Felik Harmanto"
>> <felikharma...@yahoo.com> wrote:

>> >I did what you sad to do. But when I use Date function in my report using
>> >Quick Report,
>> >the date format still 'mm/dd/yy' and also every control (TDBEdit with
>date
>> >data) in my form when I edit, the format still 'mm/dd/yy'.

>> >Is it possible to make TDBEdit control in mode editing be formatted like
>> >'dd/mm/yyyy'?

>> >So... please tell me how to make a DEFAULT format for date in all
>> >APPLICATION?

>> Re-reading the previous messages it sounds like you changed the
>> LongDateFormat instead of the ShortDateFormat like you were told to.

>> To change the date format for all Windows applications, together with
>> your running application, use:

>>       ShortDateFormat := 'dd/mm/yyyy';
>>       SetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE,
>>         PChar(ShortDateFormat));

>> HTH,

>> Jan

Re:Date formatted 'dd/mm/yyyy'


use windows control panel

first :
settings control panel,BDE Administrator
on configuration tab, click system/formats/date and change date mode to 1
(dd/MM/yyyy), change [four digit year,leadingzerod,leadingzerom] to true

second:
settings, controlpanel ,regional settings
on date tab , change short date style to dd/MM/yyyy

Quote
Felik Harmanto <felikharma...@yahoo.com> wrote in message

news:38fd0d6f@dnews...
Quote
> Hi...

> How to setup all date data (Tfield, Date) in Application with format like
> 'dd/mm/yyyy' ?

> Thanks

Other Threads