Solved

FormatDateTime

Posted on 1998-11-26
1
728 Views
Last Modified: 2010-04-04
In Regional Setting - Date, I'm using format like this :
     mm/dd/yy

In my program I'm using FormatDateTime function like this :

const
  MyDate = '27/11/1998';

begin
  Label1.Caption := FormatDateTime('dddd dd mmmm yyyy',StrToDate(MyDate));
end;

If I run this program, I found error !
But if I change Date in Regional Setting like this :
     dd/mm/yy

I don't found error !

What is the function FormatDateTime if this function still using Windows's date system ?
0
Comment
Question by:joely
1 Comment
 
LVL 2

Accepted Solution

by:
kjteng earned 10 total points
ID: 1348144
I don't think this error is due to formatDateTime. It is the StrToDate function that cause the error because StrToDate use the ShortDateFormat.
One way to solve your problem is to set
ShortDateFormat := 'mm/dd/yy' (or other format as you like)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

930 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now