CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Format Date

General discussion

by etwoss » 22 May 2014 11:31

Hii

I use a datepicker which shows a date like '05/21/2014'

I also have a list of dates.
I get these dates as a integer value so, put them in a TDateTime and translate to String

However i than het 21-5-2014 (format of my pc)

How can i get to the date format of the browser , like datapicker does?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 22 May 2014 11:45

Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by etwoss » 22 May 2014 12:55

Hi

On my pc the shortdateformat equals to d-M-YYYY
In Delphi if i ask shortdateformat i get 'd/M/yyyy'

Delphi formats the date ,even when FormatSettings.ShortDateFormat = 'd/M/yyyy' to 'd-m-yyyy', so takes the correct settings
Code: Select all
     cbAnswer.Items.AddOption(FormatDateTime(FormatSettings.ShortDateFormat, LDate),  IntToStr(i));


Gives 30-5-2014

I also set

Code: Select all
 IWCGJQDatePicker.JQDatePickerOptions.DateFormat := FormatSettings.ShortDateFormat;


The daypicker correctly shows 30/5/2014

Eric
You do not have the required permissions to view the files attached to this post.
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by etwoss » 22 May 2014 13:00

So formatsettings.ShortDateFormat does not use the right dateSeparator

So added:
Code: Select all
  if pos(FormatSettings.DateSeparator,FormatSettings.ShortDateFormat) > 0  then
    IWCGJQDatePicker.JQDatePickerOptions.DateFormat := FormatSettings.ShortDateFormat
  else
    IWCGJQDatePicker.JQDatePickerOptions.DateFormat := StringReplace(FormatSettings.ShortDateFormat, '/', FormatSettings.DateSeparator,                      [rfReplaceAll]);
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58


Return to General - Archive

Who is online

Users browsing this forum: No registered users and 4 guests

Contact Us.