Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 12 total
Thread Non-US Date Format
Thu, Jan 22 2015 9:32 PMPermanent Link

Roland

Montro

How do I get an EWB application to use the host computer's date format?

All I get is the mm/dd/yyyy format when displaying dates in TEdit controls.
Roland
Fri, Jan 23 2015 3:21 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Hi Roland,

use something like this:

      FormatSettings.ShortDateFormat := 'dd/MM/yyyy';

Chris Holland
[Team Elevate]

On 23/01/2015 02:32, Roland wrote:
> How do I get an EWB application to use the host computer's date format?
>
> All I get is the mm/dd/yyyy format when displaying dates in TEdit controls.
> Roland
>
Fri, Jan 23 2015 4:08 AMPermanent Link

Malcolm Taylor

Roland wrote:

> How do I get an EWB application to use the host computer's date
> format?
>
> All I get is the mm/dd/yyyy format when displaying dates in TEdit
> controls.  Roland

There is an earlier thread on this, but here is what I have in my code:

{code}

initialization
 // As of V1.02 b2 the FormatSettings are hard coded to US English.
 // Tim has said Locale detection is on the 'list' but we are not
 // to ask when it will be delivered.   Smile

 // At present you can adjust these properties at initialization as
shown below,
 // or I guess you can prompt the user

 // Set the date separator first if not '/'
 FormatSettings.DateSeparator := '-';
 FormatSettings.ShortDateFormat := 'yyyy-MM-dd';  // ISO date format
 // other properties as appropriate...

{code}
Fri, Jan 23 2015 7:36 PMPermanent Link

Roland

Montro

Thanks Guys
Roland
Sun, Nov 29 2015 1:39 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

Just dug up this old thread as I'm having the same issue.

I have a form with datecombo controls on and I've created an initialization block with the above code in.

On first load, the controls show the standard (USA) time format. When I click the control to set the date it switches to the "correct" format I set above.

Any way it can show this format on form load?
I have tried to put the format lines in various create/show events but it doesn't seem to make any difference.

A system wide way would be super .. Wink
Sun, Nov 29 2015 6:54 PMPermanent Link

Malcolm Taylor

Squiffy

Is the code in the initialisation of the first unit to be created?
I don't set it anywhere else .. but neither do I display any date or
time values before the user makes an entry.

Malcolm
Mon, Nov 30 2015 2:43 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

Hi,
I was initially testing as a single page app, so the initialization had to be in the same page as the date manipulation. But now I have put login pages in the way and can perform the init in there before my date page is loaded, the problem has gone away.

Cheers,
Mon, Nov 30 2015 2:47 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

Actually, no. I speak too soon.
My onShow event for the form was updating the control to force the formatting to occur (this was my original work around).

Even with the init taking place on the parent form to the date form, the formatting doesn't take place until I manipulate the date control in some way. It's own initialisation doesn't seem to take in to account the formatting.

I'll post a small demo of this action in a minute.
Mon, Nov 30 2015 2:56 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

Attached is a small project to demo the effect.



Attachments: testdate.zip
Mon, Nov 30 2015 4:03 AMPermanent Link

Malcolm Taylor

squiffy wrote:

> Attached is a small project to demo the effect.

When I run your test I see the same issue.
But I notice that the Text property is present at design time.

So, I cleared the text field and at run time it started empty.
Then I tried adding the following in the form's On Create:

{code}
 DateEditComboBox1.Text := DateToStr(Now);
{code}

That populated the control with the current date in the desired format.
So I think your issue was having a Text value at design time .. maybe.
Page 1 of 2Next Page
Jump to Page:  1 2
Image