Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
RTL
Delphi
Arithmetic
ConvUtils
Date - Time
DateUtils
File Management
Format + Float
Input/Output
Math Unit
Memory, Pointer, Address
Null-terminated strings
Other Classes
Other RTL
Pascal Strings
Regular Expressions
RTL Exceptions
Text Files
Thread support
Typed/Untyped Files
WinAPI
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/RTL/Delphi/Date - Time
[ Add a report in this area ]
Report #:
23301
Status:
Open
StrToDateTime does not work for mmm months
Project:
Delphi
Build #:
10.0.2166.28377
Version:
10.0
Submitted By:
Dan Miser
Report Type:
Suggestion / Enhancement Request
Date Reported:
1/9/2006 5:38:42 PM
Severity:
Commonly encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
152897
Resolution:
Deferred to Next Rel
(Resolution Comments)
Resolved in Build:
:
Duplicate of:
None
Voting and Rating
Overall Rating:
(7 Total Ratings)
4.71 out of 5
Total Votes:
6
Description
None
Steps to Reproduce:
Go to regional settings and change date format to one of the ones specified.
Try to convert a string in the valid format to a date and you will get an error
"... invlaid date time ..."
Using yyyy-MMM-dd, the following test program raises an exception error.
program Test;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
Date: TDateTime;
S: String;
begin
S := '2004-Jun-07';
Date := StrToDate(S);
WriteLn(Date);
end.
Workarounds
Call VarToDateTime instead of StrToDateTime
Attachment
TimeTest.zip
Comments
Steven Kamradt at 1/11/2006 6:41:17 AM
-
This is not limited to only mmm-dd-yyyy formats, but also international date formats with mmm as the month name. Any solution should handle foreign month names (based on regional settings) in addition to the standard english month names.
Remco Kapinga at 2/3/2006 5:34:45 AM
-
Using a computers regional settings may be incorrect.
For example, reading dates from a file created by another computer (using different time format settings) can lead to incorrect data.
Deborah Pate at 1/12/2006 11:03:06 AM
-
And to mmmm formats as well.
Sebastian Modersohn at 9/30/2006 1:53:44 PM
-
I'm surprised that this report got opened, since several almost identical reports (QC 27571, 7364 and 4047) got closed with "as designed". Note that this limitation of StrToDate is documented!
ms-help://borland.bds4/bds4win32api_win32/html/DelphiWin32_SysUtilsStrToDateRoutine.htm
clearly states "S must consist of two or three numbers, ..."
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