For Programmers: Free Programming Magazines  


Home > Archive > Clipper > September 2007 > ctod bug??









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ctod bug??
Don

2007-08-31, 6:56 pm

I may have found a bug in xHarbour for MS-VC 6.0 binaries and Borland C
++ 5.5 binaries.

x := "September 1, 2012"

? ctod( x ) ==> 01/20/2000
(should be an empty date, as in clipper and dbase)

Oddly, using 'August 29, 2007' as x - result is an empty date.

Odd, huh?

dlzc

2007-08-31, 6:56 pm

Adding comp.lang.xharbour to the distribution

On Aug 31, 2:14 pm, Don <don.lowenst...@laapc.com> wrote:
> I may have found a bug in xHarbour for
> MS-VC 6.0 binaries and Borland C
> ++ 5.5 binaries.
>
> x := "September 1, 2012"
>
> ? ctod( x ) ==> 01/20/2000
> (should be an empty date, as in clipper
> and dbase)
>
> Oddly, using 'August 29, 2007' as x -
> result is an empty date.
>
> Odd, huh?



bill robertson

2007-08-31, 9:56 pm

"Don" <don.lowenstein@laapc.com> wrote in message
news:1188594870.584711.286970@k79g2000hse.googlegroups.com...
>I may have found a bug in xHarbour for MS-VC 6.0 binaries and Borland C
> ++ 5.5 binaries.
>
> x := "September 1, 2012"
>
> ? ctod( x ) ==> 01/20/2000
> (should be an empty date, as in clipper and dbase)
>
> Oddly, using 'August 29, 2007' as x - result is an empty date.
>
> Odd, huh?
>

Hi Don

I get an empty date in xHarbour for your example using Borland C compile of
latest CVS. I don't have the binaries so maybe it's an error that's been
fixed. I ran the following program in Clipper and xHarbour and got the same
results: an empty date for the 1st example which uses an incorrectly
formatted date and the correct date for the second example.

//---------------------------------------------------
function main()
LOCAL cDate:= "September 1, 2012"

// Works correctly if following line omitted as well
Set Date Format to "mm/dd/yyyy"

? CtoD(cDate)
? CtoD("09/01/2012")

RETURN 0


Patrick Mast

2007-09-01, 7:56 am

Hey Don,

> I may have found a bug in xHarbour for MS-VC 6.0 binaries and Borland C
> ++ 5.5 binaries.
> x := "September 1, 2012"
> ? ctod( x ) ==> 01/20/2000
> (should be an empty date, as in clipper and dbase)
> Oddly, using 'August 29, 2007' as x - result is an empty date.


Seems to work with latest xHarbour:

//-------------------------------------------------------------//
PROCEDURE Main()
LOCAL cDate:="September 1, 2012"

? " CtoD( '" + cDate + "' ) = ",CtoD( cDate )
? "Empty( CtoD( '" + cDate + "' ) ) = ",Empty( CtoD( cDate ) )

WAIT

RETURN
//-------------------------------------------------------------//

Returns:

CtoD( 'September 1, 2012' ) = / /

Empty( CtoD( 'September 1, 2012' ) ) = .T.

Press any key to continue...

--
Sincerely,

Patrick Mast,
xHarbour.com Inc.
http://www.xHarbour.com

Patrick Mast

2007-09-01, 7:56 am

Hey Don,
[color=darkred]
> Adding comp.lang.xharbour to the distribution
>
> On Aug 31, 2:14 pm, Don <don.lowenst...@laapc.com> wrote:

Seems to work with latest xHarbour:

//-------------------------------------------------------------//
PROCEDURE Main()
LOCAL cDate:="September 1, 2012"

? " CtoD( '" + cDate + "' ) = ",CtoD( cDate )
? "Empty( CtoD( '" + cDate + "' ) ) = ",Empty( CtoD( cDate ) )

WAIT

RETURN
//-------------------------------------------------------------//

Returns:

CtoD( 'September 1, 2012' ) = / /
Empty( CtoD( 'September 1, 2012' ) ) = .T.
Press any key to continue...


--
Sincerely,

Patrick Mast,
xHarbour.com Inc.
http://www.xHarbour.com

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com