Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Format datetime in a grid.
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00935172
Message ID:
00935854
Views:
15
Hi sergey,

Thank very much for help.

I tried to put a function in my View.(v_resident)
*-- 08/2004 Retourne une datetime en format Caractère 99/99/99(99) 99:99
FUNCTION  cDateTimeValue( Tdate , lCentury )
 

 *-- Inspiré UT Sergey Berezniker Thread ID:   935172  
  LOCAL nLen , cDate , cOldCentury

  cOldCentury = SET("Century")

  *-- Si on veut l'année à 4 digits.
  IF lCentury = .T.
    nLen = 10
    SET CENTURY ON
  ELSE
    nLen = 8
    SET CENTURY OFF
  ENDIF


  IF EMPTY( Tdate )
    cDate = ""
  ELSE
    cDate = LEFT( TTOC( Tdate ) , nlen ) + ' ' + ;
      TRANSFORM( SUBSTR( TTOC( Tdate , 1 ) ,  9  , 4 ) , '@R 99:99' )
  ENDIF

  IF cOldCentury <> SET("Century")
   * SET CENTURY &cOldCentury
   IF cOldCentury = "ON"
   SET CENTURY ON
   ELSE
   SET CENTURY OFF
   ENDIF
  ENDIF

  RETURN PADR( cDate, nLen + 8 )




ENDFUNC
I have 2 problems.

1) it is very slow
2) the index of the column is the controlsource ( cf Advisor 05/2004. Grid simplify )
Index On date caractere is different of Date.

The format dates in my session form environment is "Short".(Windows parameters)
When I use "V_resident.dsortie" as ctrlsource (datetime) i use the short format.
When I use date shorts jj/mm/aa and Format HH:mm all is ok.

How put by programming the format shorts and Format hours For my customers ?

Thanks in advance

bernhart


>>
>"IIF( EMPTY( V_resident.dsortie ) , [] , Left(TTOC(V_resident.dsortie), 16))">
>>
>>I have a last problem now.
>>I have 08/08/2004 8:34 and I would like to have 08/08/2004 08:34
>>
>
>Bernhart,
>
>Try
>LEFT(TTOC(V_resident.dsortie),10) + " " + TRANSFORM(SUBSTR(TTOC(V_resident.dsortie,1),9,4), "@R 99:99")
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform