DateTimePicker - DateToStr  - FormatSettings

Posted on 2006-05-26
Medium Priority
Last Modified: 2010-05-18
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.


Question by:begonz
  • 3
LVL 14

Accepted Solution

Pierre Cornelius earned 300 total points
ID: 16767112
DateEntered:= FormatDateTime('yyyy-MM-dd', DateTimePicker1.Date)

Expert Comment

ID: 16767301
Hello Sir,

  AS PierreC says, you can format it using FormatDateTime function

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

with regards,
LVL 14

Expert Comment

by:Pierre Cornelius
ID: 16767351
@padmaja: why repeat what I have already said?

Author Comment

ID: 16768640
Thanks for that PierreC!  Easy points.  I almost had it just around the wrong way.  :o)
LVL 14

Expert Comment

by:Pierre Cornelius
ID: 16768711
glad to help

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question