Hi Przemek,

Il 19/10/2009 9.49, Przemysław Czerpak ha scritto:
On Sun, 18 Oct 2009, Francesco Saverio Giudice wrote:

Hi,

could you kindly add these functions ?
HB_TTOD( tTimeStamp ) -> dDate

I'll add it though it's interesting to know why you need it.
You can you tTimeStamp instead of dDate in all places so if you found
something in core code which needs date parameter and does not accept
timestamp then I would like to know what it is.


Infact is not for core code, but for functions that have "old" parameters separated like MyFunc( dDate, cTime ) and in case of explicit check of date and time like:

   ? "cTime      = ", cTime := Time()
   ? "dDate      = ", dDate := Date()
   ? "tTimeStamp = ", tTimeStamp := hb_DateTime()

   ? dDate == tTimeStamp // it returns .F.
? cTime == tTimeStamp // this gives "Error BASE/1070 Argument error: =="

BTW xHarbour does not have DATE type at all. Though valtype() returns "D"
then it uses internally only TIMESTAMP and I haven't seen that people
protested against it.

Now if I have a timestamp value I need to make:
CTOD( HB_DTOC( tTimeStamp ) ) -> dDate
or better:
STOD( HB_TTOS( tTimeStamp ) ) -> dDate

More efficient is:

   function HB_TTOD( tTimeStamp )
   return HB_CTOD( "" ) + HB_TTON( tTimeStamp )


Thank you

HB_TTOT( tTimeStamp ) -> cTime

Here the name is confusing.
I though that you need function which works like:

   function HB_TTOT( tTimeStamp )
   return HB_NTOT( HB_TTON( tTimeStamp ) % 1 )

which returns timestamp value which contains only the time in a day
without days but then I've seen your example which returns time string:

HB_TTOC( tTimeStamp, "", "HH:MM:SS" ) -> cTime

So we need other name for such function and there is still question
what is wrong with above conversion and why you do not want to use
HB_TTOC().
As far as I know no one suggested to add to core code functions like:
   HB_DTOANSI( dDate ) -> "YY.MM.DD"
or:
   HB_DTOBRITISH( dDate ) -> "dd/mm/yy"
which give such functionality but for date values and people preferred
functions like HB_DTOC() with additional format parameter.

I have not request formatting functions, simply functions that extract date and time parts from a timestamp value.

But I can do the same using #xtranslate command or adding function at prg level. My request is only to have a core function if this is faster than using prg functions.

About names mine was only a proposal.

Thank you and Best Regards,
Francesco

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

Reply via email to