467,134 Members | 1,058 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,134 developers. It's quick & easy.

How to display a date stored in a table with the desired way?

I have a table where I store dates in smalldatetime format like this '2008-07-28 14:47:00' I want in PHP to retrieve these values and display them like '28/07/08' I retrieved the dates from the table and inside the first loop I put

Expand|Select|Wrap|Line Numbers
  1. $qdate=mssql_query("select CONVERT(varchar(20), '$rcrit[5]', 103)");    
where $rcrit[5] the variable holding the date, saddly it didnot work I tried in MSSQL to put
Expand|Select|Wrap|Line Numbers
  1. CONVERT(varchar(20),'2008-07-28 14:47:00' ,104)
but still it does not show the desired format any ideas?
Sep 16 '08 #1
  • viewed: 1050
3 Replies
code green
Expert 1GB
"It did not work" is not very helpful. What did you get?
The PHP syntax looks like it will fail to me.
Was there an error?
Sep 16 '08 #2
Expert 2GB
Since you're looping through the result set, can't PHP handle it rather than SQL Server?

-- CK
Sep 16 '08 #3
Expert 512MB
Try this:

Expand|Select|Wrap|Line Numbers
  1. select CONVERT(varchar(20),convert(datetime, '2008-07-28 14:47:00') ,103)
Good Luck.
Sep 16 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Thomas R. Hummel | last post: by
8 posts views Thread by John Wildes | last post: by
11 posts views Thread by Lauren Quantrell | last post: by
5 posts views Thread by Peter Lapic | last post: by
2 posts views Thread by syntego@gmail.com | last post: by
2 posts views Thread by Brad Pears | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.