Page 1 of 1

Day with leading 0

Posted: Sun Jun 17, 2007 11:43 am
by spacebiscuit
Hi,

I am using the day() function to select the day of the week, is it possible to format the day so that it has a leading zero for days 1-9?

Thnaks in advance,

Rob.

Posted: Sun Jun 17, 2007 11:55 am
by superdezign

Posted: Sun Jun 17, 2007 12:55 pm
by spacebiscuit
Thanks for the reply, I am not sure that will work in my case, here is the syntax i am using:

Code: Select all

select *, day(period_start_date) d1, left(month(period_start_date)....
Can it be done?

Thanks,

Rob.

Posted: Sun Jun 17, 2007 1:02 pm
by superdezign
In SQL? No. It returns a number, not a string. Try just getting the whole period_start_date and formatting it with PHP's date() function.[/syntax]

Posted: Sun Jun 17, 2007 1:40 pm
by Oren