Current archive: 2003.05.01;
DateTimeFormat - In the entire application Find similar branches← →
Silver_ (2003-04-17 14:44) 
In general, how to make it so that the entire application uses a defined Date format that is different from the standard one, but without changing it.
REA (2003-04-17 15:11) 
Change global format variable.
Silver_ (2003-04-17 16:27) 
> REA © (17.04.03 15: 11)
apparently you know what HOW ???
Anatoly Podgoretsky (2003-04-17 16:32) 
First of all, it doesn't work, Windows knows nothing about Borland local variables.
And secondly, see Currency and date / time formatting variables
Dms (2003-04-17 16:35) 
use the function throughout the application
FormatDateTime (sFormat, Now): string
and there will be no such problems
y-soft (2003-04-17 16:41) 
Then it is better to write and use a globally accessible function throughout the application.
function FormatDT (DateTime: TDateTime): string const DT_FORMAT = "dd.mmmm.yyyy hh: nn: ss"; // Own format begin Result: = FormatDateTime (DT_FORMAT, DateTime); end;
Anatoly Podgoretsky (2003-04-17 16:48) 
Dms (17.04.03 16: 35)
And in the DateTimePicker?
Silver_ (2003-04-17 17:09) 
> Dms (17.04.03 16: 35)
> use the function throughout the application
> FormatDateTime (sFormat, Now): string
> and there will be no such problems
Not guys, this is not the case because if I request a query or filter, I format the date in this way I think Delphi (or anyone else) will curse, it will simply not in terms of what I send to him there
y-soft (2003-04-17 17:25) 
> Silver_ ©
What format are we talking about - the display / output format?
> Anatoly Podgoretsky © (17.04.03 16: 48)
>> Dms (17.04.03 16: 35)
>> And in the DateTimePicker?
DTM_SETFORMAT or DateTime_SetFormat and will output in any desired format
Dms (2003-04-17 17:33) 
in the query and in the filter it should be inserted, for example, I had this:
DM.tableBeznal.Filter: = Format ("DATE_IN between"% s "and"% s "", [FormatDateTime ("dd.mm.yy", DM.dateBegin), FormatDateTime ("dd.mm.yy", DM .dateEnd)]); DM.tableBeznal.Filtered: = True;
BBCHa (2003-04-17 17:37) 
Well, use ShortDateFormat: = "dd.mm.yyyy";
Anatoly Podgoretsky (2003-04-17 17:51) 
Silver_ © (17.04.03 17: 09)
Of course, you can transfer to the filter using the string format of a local or system file, but you’ll understand that it will not work.
Silver_ (2003-04-17 19:14) 
> Anatoly Podgoretsky © (17.04.03 17: 51)
... but gotavtsa to what will not work will work.
I so imagine and imagine therefore I want EVERYWHERE where I use Now, Date, Time, TDateTime, ... I used the system on EKRAN (in grades, DateTimePicker, or in any other controls) any other format
> y-soft © (17.04.03 17: 25)
> What format are we talking about - the display / output format?
I think answered
DTM_SETFORMAT or DateTime_SetFormat And so what
There may be an option with a temporary change in the system format, or a global variable (while my application is active), although it’s still possible to be remembered in NT, it’s not the lack of user rights to act like this
Dms (2003-04-17 19:55) 
Well, explain what you do not like FormatDateTime?
y-soft (2003-04-17 20:07) 
> Silver_ © (17.04.03 19: 14)
> DTM_SETFORMAT or DateTime_SetFormat And there’s something like that
This is a way to change the DateTimePicker output format.
Babay (2003-04-18 06:22) 
Che, I didn’t completely understand what to do specifically
I like this situation. Users work with MSSQL through my program. They have different time formats on their machines. (so it happened who has English who has Russian). SQL Server for example English has. In my program, requests are made and dynamically including the date and time in the request too.
I got out of the situation as follows (while there were still no glitches with this solution for 2, the year of operation of the complex and the constant change of systems for users)
So in onCreate of the main form I write this
LongDateFormat: = "dmyyyy"; DateSeparator: = ".";
ShortDateFormat: = "dd.mm.yyyy"; TimeSeparator: = ":";
ShortTimeFormat: = "hh: mm"; LongTimeFormat: = "hh: mm: ss";
DecimalSeparator: = ".";
These settings affect the current on my program, so I make requests in accordance with the given settings. All translations of time-to-line and back (standard functions) work according to the specified format.
When connecting to SQL, it is necessary for the session to agree with SQL on the date transfer format.
to send him a command
set dateformat dmy
after that, for this session, SQL takes the date as
So my programs do not depend on regional settings on the user's machine.
I hope that this is the answer to your question. (although maybe I did not understand the question ...)
Pages: 1 whole branch
Current archive: 2003.05.01;
Memory: 0.61 MB
Time: 0.039 c