PDA

View Full Version : date_format


Ghostsuit
12-16-2009, 10:30 PM
This is related to the PHP widget question (https://vborg.vbsupport.ru/showthread.php?t=230342) I had

I have this code

SELECT date_format(gig.date, '%a %D %b %Y') AS gig_date,

returns

510025a 17th Dec 2009

Now that should return something like

Thurs 17th Dec 2009

Anyone ideas why it's not?

vaskies
12-17-2009, 06:24 AM
Are you sure gig.date is a valid date? This might be useful: http://www.w3schools.com/SQL/func_date_format.asp Scroll to the bottom for examples. Otherwise I'd guess your error lies somewhere else in your code.

Ghostsuit
12-17-2009, 11:05 AM
Yeah the gig.date is 2009-12-17 and the code works fine on vb3 but in vb4 it displays with the numbers at the start rather than the Day.

Something very odd happening.

--------------- Added 18 Dec 2009 at 10:54 ---------------

ok jsut realised that when you save the widget the

SELECT date_format(gig.date, '%a %D %b %Y')gets changed to with out the spaces between % u0025 and a

SELECT date_format(gig.date, '% u0025 a %D %b %Y')anyway to stop that or is it a bug?

Ghostsuit
12-21-2009, 10:20 AM
For the record this was a bug in the PHP widget. vBulletin have it at confirmed pending so should be fixed after rc4.

Lynne
12-21-2009, 02:14 PM
That's a weird one - good catch!

Ghostsuit
12-21-2009, 02:42 PM
Yup very strange.