Re: [PHP4BETA] PHP4 + MSSQL + DATETIME datatype?

[email protected] (Andrian Pervazov)
Newsgroups php.version4
Message-ID <[email protected]>
"Ulrich, Eric J" wrote:
> 
> I am have a weird problem pulling dates out of a SQL 7.0 database.
> Here is the code:
> 
> SELECT (SELECT MIN(LogTime) FROM wwwlog) AS 'BeginDate', (SELECT
> MAX(LogTime) FROM wwwlog) AS 'EndDate'
> 
> Nothing big!
> here is the format I get:
> Dec 24 1999 5:50PM which it is stored 12/24/1999 5:50:16 PM
> if I try  strftime("%m-%d-%Y %r" , Time) I get 12-31-1969
> If anyone can help great.
> Thanks,
> Eric Ulrich

Perhaps you can get the format you want from the SQL server. Try using
the CONVERT() function with the style option. I guess
convert(char(20),time_field,100) will do the job.

Andrian

Andrian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.