Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Show only 2 digits for a year
Message
From
30/12/2008 00:28:09
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01370078
Message ID:
01370082
Views:
15
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>Is there a simple way to show date as
>
>mm/dd/yy regardless of set century setting?
FUNCTION NaomisDate( tdDate AS Date ) AS Character

LOCAL ;
	lcOldDateSetting ;
	, lcOldCenturySetting ;
	, lcRetVal

lcOldDateSetting = SET( "DATE" )
lcOldCenturySetting = SET( "CENTURY" )

SET DATE AMERICAN
SET CENTURY OFF

lcRetVal = DTOC( tdDate )	

SET CENTURY &lcOldCenturySetting
SET DATE &lcOldDateSetting

RETURN lcRetVal
	
ENDFUNC

FUNCTION NaomisDate2( tdDate AS Date ) AS Character

RETURN TRANSFORM( MONTH( tdDate ), "@L, 99" ) ;
	+ "/" ;
	+ TRANSFORM( DAY( tdDate ), "@L, 99" ) ;
	+ "/" ;
	+ RIGHT( STR( YEAR( tdDate ) ), 2 )
	
ENDFUNC
Which is more maintainable? You be the judge.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform