Hii....i am plannning to implement a portal using php.I am using ms sql server 2008 as the database and hosting it with IIS 6.I am facing problem for the following
-I am trying to grab a date value from the database and echoing it.I tried using " $empdoj =date("d/m/Y", strtotime($row['emp_doj']));"($emp_doj is the sqlserver attribute) but it is showing 01/01/1970 always.
Thanks for the help in advance..
date fetching problem
Moderator: General Moderators
-
amargharat
- Forum Commoner
- Posts: 82
- Joined: Wed Sep 16, 2009 2:43 am
- Location: Mumbai, India
- Contact:
Re: date fetching problem
please check what value $row['emp_doj'] gets you
Re: date fetching problem
actually the value of emp_doj is 2010/05/31 but the output of the code returns 01/01/1970
-
amargharat
- Forum Commoner
- Posts: 82
- Joined: Wed Sep 16, 2009 2:43 am
- Location: Mumbai, India
- Contact:
Re: date fetching problem
Your code is fine and checked with given value.
Just verify $row['emp_doj'] whether it returns a correct date or empty
Just verify $row['emp_doj'] whether it returns a correct date or empty
Re: date fetching problem
Hi thanks for the help.The value of the variable was correct but it was only returning one value.Luckily I tried $empdor=sqlsrv_get_field( $stmt,8,SQLSRV_PHPTYPE_STRING( SQLSRV_ENC_CHAR)); it worked.
Thanks
Faiz
Thanks
Faiz