This is a problem present using Visual Studio 2005, but not in Visual
Studio 2003 or Visual C++ 6.
COleDateTime modernDate( 1900, 1, 1, 0, 1, 0 );
COleDateTime problemDate( 1753, 1, 1, 0, 1, 0 );
CString isoDate = modernDate.Form at(_T("%Y-%m-%dT%H:%M:%S"));
isoDate = problemDate.For mat(_T("%Y-%m-%dT%H:%M:%S")); // problem!
problemDate.For mat triggers an assertion failure on line 783 of strftime.c:
_VALIDATE_RETUR N( ( timeptr->tm_year >=0 ), EINVAL, FALSE)
So any date where the year is earlier than 1900 will result in
timeptr->tm_year containing a negative value and fail the assertion on
line 783 of strftime.c if %Y is requested in the format string.
Is this a bug, or am I missing something?
Thanks,
Ian 5 4210
Hi Ian! COleDateTime problemDate( 1753, 1, 1, 0, 1, 0 );
I think this is not allowed:
<quote>
The DATE type is implemented as a floating-point value, measuring days
from midnight, 30 December 1899. So, midnight, 31 December 1899 is
represented by 1.0. Similarly, 6 AM, 1 January 1900 is represented by
2.25, and midnight, 29 December 1899 is – 1.0. However, 6 AM, 29
December 1899 is – 1.25.
</quote>
--
Greetings
Jochen
My blog about Win32 and .NET http://blog.kalmbachnet.de/
Sorry... I forgot about the negativ numbers ;-(
<quote>
The COleDateTime class handles dates from 1 January 100 – 31 December 9999.
</quote>
--
Greetings
Jochen
My blog about Win32 and .NET http://blog.kalmbachnet.de/
Hi Ian! This is a problem present using Visual Studio 2005, but not in Visual Studio 2003 or Visual C++ 6.
COleDateTime problemDate( 1753, 1, 1, 0, 1, 0 ); isoDate = problemDate.For mat(_T("%Y-%m-%dT%H:%M:%S")); // problem!
The simplest repro-code is:
COleDateTime dt( 1753, 1, 1, 0, 1, 0 );
CString year = dt.Format(_T("% Y"));
It seems that this is a bug... of course there are a entry in ladybug:
COleDateTime::F ormat("%Y") with m_dt set to 0.0 fails with
invalid_paramet er http://lab.msdn.microsoft.com/produc...d-e15981250119
It seems that the bug is fixed but not yet available to public...
If you need a hotfix you might ask Product support to get one.
--
Greetings
Jochen
My blog about Win32 and .NET http://blog.kalmbachnet.de/
Jochen Kalmbach [MVP] wrote: Hi Ian!
This is a problem present using Visual Studio 2005, but not in Visual Studio 2003 or Visual C++ 6.
COleDateTime problemDate( 1753, 1, 1, 0, 1, 0 ); isoDate = problemDate.For mat(_T("%Y-%m-%dT%H:%M:%S")); // problem!
The simplest repro-code is:
COleDateTime dt( 1753, 1, 1, 0, 1, 0 ); CString year = dt.Format(_T("% Y"));
It seems that this is a bug... of course there are a entry in ladybug:
COleDateTime::F ormat("%Y") with m_dt set to 0.0 fails with invalid_paramet er http://lab.msdn.microsoft.com/produc...d-e15981250119
It seems that the bug is fixed but not yet available to public... If you need a hotfix you might ask Product support to get one.
Thank you. At least it is confirmed as a bug. I didn't know MS bugs
were accessible online, that's useful to know.
Ian
Does anyone know what the hotfix number is for this issue? I contacted
Microsoft Professional Support here in Sweden but they could not find it and
the bug id (FDBK26782) didn't seem to help them.
Thanks!
/Henrik
"Jochen Kalmbach [MVP]" wrote: Hi Ian! This is a problem present using Visual Studio 2005, but not in Visual Studio 2003 or Visual C++ 6.
COleDateTime problemDate( 1753, 1, 1, 0, 1, 0 ); isoDate = problemDate.For mat(_T("%Y-%m-%dT%H:%M:%S")); // problem!
The simplest repro-code is:
COleDateTime dt( 1753, 1, 1, 0, 1, 0 ); CString year = dt.Format(_T("% Y"));
It seems that this is a bug... of course there are a entry in ladybug:
COleDateTime::F ormat("%Y") with m_dt set to 0.0 fails with invalid_paramet er http://lab.msdn.microsoft.com/produc...d-e15981250119
It seems that the bug is fixed but not yet available to public... If you need a hotfix you might ask Product support to get one.
-- Greetings Jochen
My blog about Win32 and .NET http://blog.kalmbachnet.de/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: MLH |
last post by:
If I run this...
For i = -1 To -12 Step -1
Debug.Print CStr(Month(DateAdd("m", i, Now))) & "/";
CStr(Year(DateAdd("m", i, Now)))
Next i
I get this...
5/2005
4/2005
3/2005
|
by: spm_no |
last post by:
Hi,
I am using Access 2002 and am creating a scatter-chart on a form in
which the X-axis is a date. I can format and display the x-axis
properly as a date. However, when I close and reopen Access, the data
are incorrectly plotted with an x-axis that begins with a date of 1900.
Only by toggling from the option "chart by column" to "chart by row"
and then back to "chart by column", can I get the correct date on the
x-axis.
The problem...
|
by: 2D Rick |
last post by:
I open a InputBox for specific formatted data and pass return to a
variable.
The format and length remain constant: yyCC looks like 05MR
Is there a quick way to verify the input meets the format requirement.
Done in VBA using Access2003
Rick
|
by: fwidget |
last post by:
Hi All,
I actually encounter a problem when storing COleDatetime in an Access97 database, when the COleDateTime day is <= 12, the day and month are swapped when I look at the record newly inserted in the database, but when the day is >= 13, all is ok. I searched to find a solution, it seems that the regional settings available in the control panel or via the SetLocaleInfo win32 sdk can solde the solution, provided that you set the short date...
|
by: Paolo |
last post by:
We are experiencing a problem with COleDateTime while migrating our MFC&ATL project from VC++6.0 to VC++7.1 (Visual Studio .NET 2003).
COleDateTime has a DATE conversion operator that in 7.1 asserts when the date state is not valid. But we may need to pass NULL dates (read from a database) to our COM clients! - Yes, this problem doesn't occur in Release version, but we can't have a Debug version that asserts from time to time :)
A solution...
| |
by: Tony H |
last post by:
When I try to serialize COleDateTime, I get " binary '>>' : no operator found
which takes a right-hand operand of type 'ATL::COleDateTime'".
I have a file being shared by both VS6 and VS2005 code.
How do I read/write a file with COleDateTime classes?
--
Tony H
|
by: AST |
last post by:
Hey,
Can anybody tell me why the ATL::ColeDateTime implementation is referenced
rather than the MFC implementation? The method GetAsDBTIMESTAMP(...) is
only available on the MFC implementation and not ATL. Is there a compiler
directive or switch or namespace that I am missing that precludes this?
Best regards,
Bill
|
by: samuelberthelot |
last post by:
Hi,
Here is what I'm trying to achieve:
The user enters in the textbox a date. It can be:
02.05.2006 or any other separator...
02052006
020506
any other formats should be forbidden.
When the user leaves the textbox then the date should be displayed as
|
by: Dirk Hagemann |
last post by:
Hello,
From a zone-file of a Microsoft Active Directory integrated DNS server
I get the date/time of the dynamic update entries in a format, which
is as far as I know the hours since january 1st 1901.
For Example: the number 3566839 is 27.11.07 7:00. To calculate this in
Excel I use this:
="01.01.1901"+(A1/24-(REST(A1;24)/24))+ZEIT(REST(A1;24);0;0) (put
3566839 in field A1 and switch the format of the result-field to the
corresponding...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |