Link to home
Start Free TrialLog in
Avatar of begonz
begonz

asked on

DateTimePicker - DateToStr - FormatSettings

Can anyone tell me, how I can format a date that is in a DateTimePicker.

What the problem is, I have a DateTimePicker on a form and the input format is, yyyy/MM/dd.  That is fine.  When I try and use this value it puts it in a different format, dd/MM/yyyy.

I am doing the following:

DateEntered := DateToStr(DateTimePicker1.Date);

How can I force the date to be in the format yyyy/MM/dd into a variable to use, like it is on the screen???  I tried playing around with FormatSettings but just got lost.

Thanks.

Bego.
ASKER CERTIFIED SOLUTION
Avatar of Pierre Cornelius
Pierre Cornelius
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello Sir,

  AS PierreC says, you can format it using FormatDateTime function

 DateEntered := FormatDateTime('yyyy/MM/dd',DateTimePicker1.Date)

with regards,
padmaja.
@padmaja: why repeat what I have already said?
Avatar of begonz
begonz

ASKER

Thanks for that PierreC!  Easy points.  I almost had it just around the wrong way.  :o)
glad to help