Hi Przemyslaw Czerpak

I would like to make a suggestion for the function dTOc (), a second parameter with the output format, something like this:
? dtoc (date (), "MM-DD-YYYY)
? dtoc (date (), "MM-YYYY)
? dtoc (date (), "YYYY-DD)

I did this on xHarbour, follows the source:

#pragma BEGINDUMP
#include <ctype.h>
#include "hbapi.h"
#include "hbapierr.h"
#include "hbapiitm.h"
#include "hbset.h"
#include "hbdate.h"

HB_FUNC(  DTOC )
{
   if( ISDATE( 1 ) )
   {
      char szDate[9];
      char szFormatted[ 11 ];
hb_retc( hb_dateFormat( hb_pardsbuff( szDate, 1 ), szFormatted, (ISCHAR(2)?hb_parcx(2):hb_set.HB_SET_DATEFORMAT) ) );
   }
    else
    {
hb_errRT_BASE_SubstR( EG_ARG, 1118, NULL, "DTOC", 1, hb_paramError( 1 ) );
    }
 }

#pragma ENDDUMP





Przemyslaw Czerpak escreveu:
Hi All,

I would like to ask VFP users to give me an information about some
timestamp/datetime transformations in this language.
I'm interesting in existing functions transform pictures, etc.
I'm ready to commit timestamp support to HVM but I do not want
to reinvent the wheel and create corresponding functions which
will return different results then in other xbase languages.
In longer terms such differences creates serious problems, f.e.
when you try to share tables and indexes.
xHarbour has set of functions to operate on timestamp values but
I do not know if they exactly replicates VFP results. I'm interesting
mostly on functions like:
   TTOS()
   TTOC()
   CTOS()
   CTOT()
   <other functions which operates on timestamp/datetime values>
f.e. what is the results of this code:
   proc main()
      ? TTOS( {^ 2009/03/31 11:34:56.123 PM } )
      ? TTOC( {^ 2009/03/31 11:34:56.123 PM } )
   return

I'm also interesting also in picture modifiers which are used for
timestamp/datetime values in TRANSFORM() function and GET system.
Of course if any exists.

If someone has some knowledge about timestamp/datetime type conversions
in other xbase languages then I would like to hear about them too.

I hope that you can help. Otherwise I will have to make some arbitrary
decisions myself.

best regards,
Przemek

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to