Board index » delphi » Date format dd-mm-yyyy

Date format dd-mm-yyyy

Hi,

maybe you could use the global variables ShortDateFormat and
LongDateFormat.

good luck!

--
Martijn Tonies
http://surf.to/seal97

overl...@overlease.nl wrote in article <6g2rrf$...@reader2.wxs.nl>...

Quote
> Hi,
> I want to have for my Paradox date fields the format dd-mm-yyyy  (year
> on 4 positions) and to fix it at the begining of my Delphi 2.0
> software.
> I want to define the date format independant of the windows
> configuration of the computer.
> Do you know which Delphi statements i can use and on which event
> i have to put it ?
> Thanks for your help and have a nice weekend
> Annie

 

Re:Date format dd-mm-yyyy


Quote
overl...@overlease.nl wrote:

> Hi,
> I want to have for my Paradox date fields the format dd-mm-yyyy  (year
> on 4 positions) and to fix it at the begining of my Delphi 2.0
> software.
> I want to define the date format independant of the windows
> configuration of the computer.
> Do you know which Delphi statements i can use and on which event
> i have to put it ?
> Thanks for your help and have a nice weekend
> Annie

Liefste Annie,

Rechtstreeks uit de helpfile:

FormatDateTime formats a date-and-time value.

Unit

SysUtils

Category

date/time routines

function FormatDateTime(const Format: string; DateTime: TDateTime):
string;

Description

FormatDateTime formats the date-and-time value given by DateTime using
the format given by Format. The following format specifiers are
supported:

Specifier       Displays

c       Displays the date using the format given by the ShortDateFormat global
variable, followed by the time using the format given by the
LongTimeFormat global variable. The time is not displayed if the
fractional part of the DateTime value is zero.

d       Displays the day as a number without a leading zero (1-31).

dd      Displays the day as a number with a leading zero (01-31).

ddd     Displays the day as an abbreviation (Sun-Sat) using the strings
given by the ShortDayNames global variable.

dddd    Displays the day as a full name (Sunday-Saturday) using the strings
given by the LongDayNames global variable.

ddddd   Displays the date using the format given by the ShortDateFormat
global variable.

dddddd  Displays the date using the format given by the LongDateFormat
global variable.

m       Displays the month as a number without a leading zero (1-12). If the m
specifier immediately follows an h or hh specifier, the minute rather
than the month is displayed.

mm      Displays the month as a number with a leading zero (01-12). If the mm
specifier immediately follows an h or hh specifier, the minute rather
than the month is displayed.

mmm     Displays the month as an abbreviation (Jan-Dec) using the strings
given by the ShortMonthNames global variable.

mmmm    Displays the month as a full name (January-December) using the
strings given by the LongMonthNames global variable.

yy      Displays the year as a two-digit number (00-99).

yyyy    Displays the year as a four-digit number (0000-9999).

h       Displays the hour without a leading zero (0-23).

hh      Displays the hour with a leading zero (00-23).

n       Displays the minute without a leading zero (0-59).

nn      Displays the minute with a leading zero (00-59).

s       Displays the second without a leading zero (0-59).

ss      Displays the second with a leading zero (00-59).

t       Displays the time using the format given by the ShortTimeFormat global
variable.

tt      Displays the time using the format given by the LongTimeFormat global
variable.

am/pm   Uses the 12-hour clock for the preceding h or hh specifier, and
displays 'am' for any hour before noon, and 'pm' for any hour after
noon. The am/pm specifier can use lower, upper, or mixed case, and the
result is displayed accordingly.

a/p     Uses the 12-hour clock for the preceding h or hh specifier, and
displays 'a' for any hour before noon, and 'p' for any hour after noon.
The a/p specifier can use lower, upper, or mixed case, and the result is
displayed accordingly.

ampm    Uses the 12-hour clock for the preceding h or hh specifier, and
displays the contents of the TimeAMString global variable for any hour
before noon, and the contents of the TimePMString global variable for
any hour after noon.

/       Displays the date separator character given by the DateSeparator
global variable.

:       Displays the time separator character given by the TimeSeparator
global variable.

'xx'/"xx"     Characters enclosed in single or double quotes are displayed
as-is, and do not affect formatting.
Format specifiers may be written in upper case as well as in lower case
letters--both produce the same result.
If the string given by the Format parameter is empty, the date and time
value is formatted as if a 'c' format specifier had been given.

Re:Date format dd-mm-yyyy


Try this in the project source page after the USES clauses:

{$R *.RES}

begin
  SHORTDATEFORMAT := 'MM/DD/YYYY';
end;

Re:Date format dd-mm-yyyy


Annie,

procedure TForm1.FormActivate(Sender: TObject);
begin
 Label1.Caption := FormatDateTime('dd-mm-yyyy',
StrToDateTime('4/03/98'));
end;

This may be what you want, or I might be confused.

Regards,
Don

Quote
On Sat, 04 Apr 1998 00:29:51 GMT, overl...@overlease.nl wrote:
>Hi,
>I want to have for my Paradox date fields the format dd-mm-yyyy  (year
>on 4 positions) and to fix it at the begining of my Delphi 2.0
>software.
>I want to define the date format independant of the windows
>configuration of the computer.
>Do you know which Delphi statements i can use and on which event
>i have to put it ?
>Thanks for your help and have a nice weekend
>Annie

Re:Date format dd-mm-yyyy


Hi,
I want to have for my Paradox date fields the format dd-mm-yyyy  (year
on 4 positions) and to fix it at the begining of my Delphi 2.0
software.
I want to define the date format independant of the windows
configuration of the computer.
Do you know which Delphi statements i can use and on which event
i have to put it ?
Thanks for your help and have a nice weekend
Annie

Re:Date format dd-mm-yyyy


There is also a BDE Setting that you can use to format your dates without
effecting the rest of Windows.

Matt

Quote
overl...@overlease.nl wrote in message <6g2rrf$...@reader2.wxs.nl>...
>Hi,
>I want to have for my Paradox date fields the format dd-mm-yyyy  (year
>on 4 positions) and to fix it at the begining of my Delphi 2.0
>software.
>I want to define the date format independant of the windows
>configuration of the computer.
>Do you know which Delphi statements i can use and on which event
>i have to put it ?
>Thanks for your help and have a nice weekend
>Annie

Re:Date format dd-mm-yyyy


Quote
"Matthew McDermott" <matt...@acpm.edu> wrote:
>There is also a BDE Setting that you can use to format your dates without
>effecting the rest of Windows.

in response to a question about changing the data format to dd-mm-yyyy at the
begining of a Delphi application to fix 2-yr date problems...

I thought that the ShortDateFormat and LongDateFormat globals were initialized
from Windows at app startup but that changes to Delphi's copies were not sent
back to Windows resulting in an application that used the new settings without
effecting the Windows settings.  Is this not correct?

Nate

 Foolproof systems always underestimate
 the ingenuity of a fool.

 Clipper Functions 3.0 for Delphi
 http://members.aol.com/clipfunc

Re:Date format dd-mm-yyyy


Your statement is correct. Look in the BDE Configuration|System|Formats|Date

You can set the Date Format for the BDE here.

Another alternative is to specify a Application Global variable of
'mm-dd-yyyy' or whatever format you want and after you open your table look
for TFields that are TDateFields and apply this variable to the
TFields.DisplayFormat property.

Matthew

Quote
NTrost wrote in message <1998040614454300.KAA03...@ladder01.news.aol.com>...
>"Matthew McDermott" <matt...@acpm.edu> wrote:

>>There is also a BDE Setting that you can use to format your dates without
>>effecting the rest of Windows.

>in response to a question about changing the data format to dd-mm-yyyy at
the
>begining of a Delphi application to fix 2-yr date problems...

>I thought that the ShortDateFormat and LongDateFormat globals were
initialized
>from Windows at app startup but that changes to Delphi's copies were not
sent
>back to Windows resulting in an application that used the new settings
without
>effecting the Windows settings.  Is this not correct?

>Nate

> Foolproof systems always underestimate
> the ingenuity of a fool.

> Clipper Functions 3.0 for Delphi
> http://members.aol.com/clipfunc

Other Threads