Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2003.05.01;
Download: [xml.tar.bz2];

Down

DateTimeFormat - In the entire application Find similar branches


Silver_   (2003-04-17 14:44) [0]

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) [1]

Change global format variable.



Silver_   (2003-04-17 16:27) [2]


> REA © (17.04.03 15: 11)


apparently you know what HOW ???



Anatoly Podgoretsky   (2003-04-17 16:32) [3]

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) [4]

use the function throughout the application
FormatDateTime (sFormat, Now): string
and there will be no such problems



y-soft   (2003-04-17 16:41) [5]

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) [6]

Dms (17.04.03 16: 35)
And in the DateTimePicker?



Silver_   (2003-04-17 17:09) [7]


> 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) [8]

> 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) [9]

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) [10]

Well, use ShortDateFormat: = "dd.mm.yyyy";



Anatoly Podgoretsky   (2003-04-17 17:51) [11]

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) [12]


> 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) [13]

Well, explain what you do not like FormatDateTime?



y-soft   (2003-04-17 20:07) [14]

> 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) [15]

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
dd.mm.yyyy

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

Forum: "Main";
Current archive: 2003.05.01;
Download: [xml.tar.bz2];

Top









Memory: 0.61 MB
Time: 0.039 c
7-813
Antonia
2003-03-04 11:02
2003.05.01
voltage


1-563
Sirus
2003-04-16 12:18
2003.05.01
How to determine file type entry ???


7-803
yUrrius
2003-03-13 13:19
2003.05.01
CreateProcess


3-392
S_Vladimir
2003-04-13 16:11
2003.05.01
how to select cell borders in excel


14-709
Supermagic
2003-04-12 18:48
2003.05.01
Creating component editor on Delphi





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Español swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish