Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Formats In Reports 2

Status
Not open for further replies.

drosenkranz

Programmer
Joined
Sep 13, 2000
Messages
360
Location
US
Hello,

I'm having trouble with date formats in a VFP 7.0 report. I'm getting 2 digit years but I want 4 digit years. The database's date fields have input masks (mm/dd/yyyy) already and the dates are stored and displayed on forms with 4 digit years..
I have SET CENTURY ON and
SET STRICTDATE TO 1

Things like my Date of Birth (DOB) field appear on the form as 4 digit years but only two digit years appear for the same field in my reports.

DTOC(DATE()) in my report footer prints the date 11/05/03 while
?DTOC(DATE()) from the command window returns 11/05/2003

How do I get four digit years in my report.

Thanks,

ave

The 2nd mouse gets the cheese.
 
In the field format on the report designer, you can check the Date RadioButton and then check "Set Date Format".

See if this helps

Ali Koumaiha
TeknoSoft Inc
Farmington Hills, Michigan
 
I can't reproduce the behavior you're seeing. Is it possible you have some code in the DataEnvironment of the report, or in a UDF used by the report that changes the SET CENTURY value?

Jim
 
It is very likely that you have SET CENTURY OFF for the report desgner data session.

YOu can right click on the report in the report designer,
choose data environment
double click and in the Init event of the data environment, put the code..
SET CENTURY ON
SET DATE DMY && or whatever..

and save the report. Now try it out.

:-)

____________________________________________
Ramani - (Subramanian.G) :-)
When you ask VFP questions, please add VFP version.
 
Thanks,

Don't see where I could have changed the SET CENTURY setting but Ramani's suggestion fixed the problem for all of the dates at once. Thanks for info on setting individual date formats too TekNoSDS.

Dave

The 2nd mouse gets the cheese.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top