Board index » delphi » bug in formatdatetime and need fix up

bug in formatdatetime and need fix up

in delphi unit write the follow :

ShowMessage(formatdatetime('YYYY-MM-DD',0))

you will get 1899-12-30

if you will do the same in sql server 7.0 or 6.5 you will get

1900-01-01

write select convert(datetime,0)

the 0 of Sql Server is 1900-01-01 and the zero of Delphi is 1899-12-30

2 Daya Differance !!!

is there any way to fix this ?

avi almog

 

Re:bug in formatdatetime and need fix up


What you want to fix? Just Delphi and MS SQL use different basis for dates.
0 in Delphi and 0 in MS SQL are differents zeros...
Even more - other db-servers or UNIX server use another date system.

So where is a problem?
All what you need is to return a zero from MS SQL but format it as string
you must on client side from your app instead SELECT-statement/

--
With best regards, Mike Shkolnik
EMail: mshkol...@scalabium.com
http://www.scalabium.com

"avi almog" <a...@unique-ltd.co.il> ???????/???????? ? ???????? ?????????:
news:fb3d3a2a.0210022339.36d50e9@posting.google.com...

Quote
> in delphi unit write the follow :

> ShowMessage(formatdatetime('YYYY-MM-DD',0))

> you will get 1899-12-30

> if you will do the same in sql server 7.0 or 6.5 you will get

> 1900-01-01

> write select convert(datetime,0)

> the 0 of Sql Server is 1900-01-01 and the zero of Delphi is 1899-12-30

> 2 Daya Differance !!!

> is there any way to fix this ?

> avi almog

Other Threads