Article ID: 248377 - View products that this article applies to.
This article was previously published under Q248377
This article has been archived. It is offered "as is" and will no longer be updated.
When you use the CDate function or CVDate function in the programs listed in the "Applies To" section of this article, the date returned by the function may be a two-digit year, although the function returns a four-digit year in earlier versions of the program.
The criteria that CDate and CVDate use to determine the format of their return value has changed in Microsoft Office 2000. See the "More Information" section of this article for a list of the criteria that the CDate and CVDate functions use to determine the format of their return value.
Criteria Used to Determine Format of Date Returned by CDate, CVDateThe CDate and CVDate functions return a two-digit year when both of the following conditions are true:
ExamplesMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
Example 1The following line of code
returns the following value if you are running Windows 95 and the Short date style setting in Regional Settings on the Control Panel is set to a format that displays two-digit years:
1/1/01The above line of code returns the following value if the Short date style setting in Regional Settings on the Control Panel is set to a format that displays four-digit years, regardless of the version of Windows that you are running:
Example 2The following line of code
returns the following value if the Short date style setting in Regional Settings on the Control Panel is set to a format that displays two-digit years:
1/1/50The above line of code returns the following value if the When a two-digit year is entered, interpret as a year between setting (on the Date tab, in Regional Options on the Control Panel) is set to a value of 2055:
Article ID: 248377 - Last Review: February 28, 2014 - Revision: 4.2
Contact us for more help
Connect with Answer Desk for expert help.