Reply to Re: datetime problem

Your name:

Reply:


Posted by Jerry Stuckle on 10/25/06 10:40

iulian.ilea wrote:
> Is correct to have a varchar field and insert dates of type dd/mm/yyyy
> into it? I choose this method because I have an application that runs
> on more than one server. So, if I used a datetime field (MSSQL Server)
> it worked on my test machine. If I run the same application on another
> machine with different regional settings is not working. I tried with
> date_default_timezone_set to change timezone but is not changing. After
> date_default_timezone_get the result was the new timezone but the dates
> were the same. So, after that I changed all datetime fields into
> varchar and used query's like this (see bellow) where I have date
> operations.
>
> My question: is correct to to this? Because is working on one machine
> and on another one I get an error that it can't convert char to
> datetime. My guess is that I left a datetime field unchanged or my
> ideea about using varchar instead of datetime is completely wrong.
>
> SELECT * FROM DocD WHERE CONVERT(datetime,created,101) BETWEEN
> CONVERT(datetime,'10/25/2006',101) AND
> CONVERT(datetime,'10/25/2006',101) ORDER BY cName ASC,
> CONVERT(datetime,created,101) DESC, DocID DESC
>

I think it should work. But it's a lot of unnecessary complication and
work.

Fix your problem with the datetime column. You might try
alt.databases.mssql for some help on it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация