Microsoft KB Archive/299497

= FIX: _VFP.DataToClip Truncates DateTime Data =

Article ID: 299497

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q299497



SYMPTOMS
When the Visual FoxPro (VFP) DataToClip application method is used to store data from a DateTime field to the clipboard, the data is truncated, leaving off the trailing &quot;M&quot; in AM or PM.



STATUS
This problem was corrected in Visual FoxPro version 7.0 for Windows.



Steps to Reproduce Behavior
  In Visual FoxPro (VFP) 5.0 or 6.0, paste the following code in a new program: CLEAR LOCAL lcOldSetCentury lcOldSetCentury = SET(&quot;CENTURY&quot;)

CREATE CURSOR TstCursor (fldDTime T) INSERT INTO TstCursor VALUES (DATETIME)

_VFP.DATATOCLIP ? _CLIPTEXT

SET CENTURY ON

_VFP.DATATOCLIP ? _CLIPTEXT

USE IN TstCursor SET CENTURY &lcOldSetCentury  Save and run the program (the name is not important).

This program creates a new cursor with a DateTime field and stores DATETIME to that field. The value from that field is then stored to the clipboard using _VFP.DataToClip, and the contents of the clipboard are printed to _SCREEN. This is done twice: once with CENTURY off and once with CENTURY on.

In VFP 5.0 and 6.0 the DateTime values that are stored to the clipboard are truncated and are missing the &quot;M&quot; in the AM/PM portion of the text. As a result, this code prints incomplete strings to _SCREEN in those VFP versions.

