Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Show only 2 digits for a year
Message
De
30/12/2008 00:28:09
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01370078
Message ID:
01370082
Vues:
16
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform