Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
VCL
Win 32 Controls
TAnimate
TComboBoxEx
TCoolBar
TDateTimePicker
THeaderControl
THotKey
TImageList
TListView
TMonthCalendar
TPageControl
TPageScroller
TProgressBar
TRichEdit
TStatusBar
TTabControl
TToolBar
TTrackBar
TTreeView
TUpDown
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/VCL/Win 32 Controls/TDateTimePicker
[ Add a report in this area ]
Report #:
61716
Status:
Open
Date property returns Date AND Time
Project:
Delphi
Build #:
11.0.2902.10471
Version:
11.2
Submitted By:
Alexander Alexeev
Report Type:
Minor failure / Design problem
Date Reported:
5/4/2008 10:18:32 AM
Severity:
Commonly encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
262340
Resolution:
Duplicate
(Resolution Comments)
Resolved in Build:
:
None
Duplicate of:
47614
Voting and Rating
Overall Rating:
(1 Total Rating)
5.00 out of 5
Total Votes:
4
Description
Date, Time and DateTime properties of TDateTimePicker returns the same value: date and time.
TDate(FDateTime) and TTime(FDateTime) doesn't do anything in GetDate and GetTime methods.
You should use DateOf and TimeOf functions instead (DateUtils.pas).
SYSOP:
When we have in TDateTimePicker the value "01/10/2008 12:34 am.",
imho, the following properties should return:
<TDateTimePicker>.Date -> 01/10/2008 (a double without fractional part)
<TDateTimePicker>.Time -> 12:34 am (a double between 0 and 1 - ie. the
fractional part only)
<TDateTimePicker>.DateTime -> 01/10/2008 12:34 am (the entire date-
time value)
In fact, istm, this is the rationale in having 3 (three) different properties.
What's the use in having 3 different properties if they return the same
value?
Steps to Reproduce:
None
Workarounds
None
Attachment
Test.zip
Comments
Tomohiro Takahashi at 5/6/2008 6:58:09 AM
-
Please attach simple sample project to verify your issue.
Alexander Alexeev at 5/6/2008 2:20:34 PM
-
Added.
Tomohiro Takahashi at 5/13/2008 9:06:17 AM
-
These tyeps are same format as below.
This is expected behavior.
-- System.pas --
TDateTime = type Double;
-- Controls.pas --
TDate = type TDateTime;
TTime = type TDateTime;
Alexander Alexeev at 7/17/2008 2:36:08 AM
-
Exuse me, but will there be some other resolution?
Documentation explictly says that TDate can not have fractional part:
TDate - TDate represents a _special type of TDateTime value that has no decimal part_.
I.e. TDateTimePicker behaviour is incorrect.
Please, comment this issue.
m. Th. at 5/18/2008 12:55:12 AM
-
While I agree with the mapping of the types, I rather think that the logic is a little bit 'odd' from a developer POV.
When we have in TDateTimePicker the value "01/10/2008 12:34 am.", imho, the following properties should return:
<TDateTimePicker>.Date -> 01/10/2008 (a double without fractional part)
<TDateTimePicker>.Time -> 12:34 am (a double between 0 and 1 - ie. the fractional part only)
<TDateTimePicker>.DateTime -> 01/10/2008 12:34 am (the entire date-time value)
In fact, istm, this is the rationale in having 3 (three) different properties. What's the use in having 3 different properties if they return the same value?
Alexander Alexeev at 5/13/2008 11:40:11 AM
-
Could you please comment why this is expected behavior?
Documentation says:
TDate - TDate represents a special type of TDateTime value that has no decimal part. A TDate value represents the number of days that have elapsed since 12/30/1899.
I.e. if I see the following code:
property Date: TDate ....
then wouldn't it be natural to expect no decimal part when reading this property?
Lets see at documentation of Date property:
TDateTimePIcker.Date - Indicates the date that is marked on the calendar.
Use Date to get or set the date that is marked on the calendar. The value of Date must lie within the range specified by the MaxDate and MinDate properties.
If MultiSelect is true, the selected range of dates goes from Date to EndDate.
Note: You can also set the marked date with the DateTime property.
Again, I can't figure from this text why Date property must have decimal part. Of couse, if I use DateTime property then it MUST have decimal part. But why Date property must be exactly the same as DateTime (while reading)?
The same thinking could be applied to Time property.
Thanks.
Dick Boogaers at 7/17/2008 3:08:51 AM
-
Change ComCtrls, function TCommonCalendar.GetDate as follows:
function TCommonCalendar.GetDate: TDate;
begin
// Patched as per QC 61716
// TDate is not the same as TDateTime
// Result := TDate(FDateTime);
Result := Trunc(FDateTime);
// End of patch
end;
Alexander Alexeev at 10/3/2008 8:49:40 AM
-
May be it is better to use DateOf/TimeOf from DateUtils.pas.
Joe Blow at 10/24/2011 11:08:49 AM
-
This seems to be a duplicate of 47614.
Tomohiro Takahashi at 10/25/2011 5:29:07 AM
-
Thanks for the notification. I will update internal status of this report.
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us