![]() |
convert time format
hi guyz i need ur help!!
how could i convert the time format for example i have a time 4:56 pm and i want to convert it in 16:56 so that the if i query it from the database it displays the result.? on more thing how would i iterate in this format 00 01 02 03 04 05 06 07 08 09 if i use this: for (i=0;i>10;i++) the result would be 123456789 how would i put 0's in my iteration so that it would be 2 numbers? |
Copied from Kohana's date helper:
PHP Code:
|
Quote:
Quote:
|
Haris is on fire today I see :-) ! Very nice Haris, kudos for that!
|
thanks guyz..
|
Is there any reason you take the longer approach, Geert?
|
Quote:
echo sprintf, what's that all about? Also, there is no need in this case for double quotes around the formatting string. I'm sure this isn't the first time I've seen echo sprintf posted up here, so every time I see it, I'll keep nagging! :-P |
I've never found a reason to use double quotes yet.. have you?
Some people like to do PHP Code:
PHP Code:
|
Why don't you just use a unix timestamp? You can output that in any formate with the date() function.
|
Quote:
Quote:
|
Quote:
|
Lol! I can see those monsters playing a big part in this community ;-) I'm sure we all have a few of those monsters in our code.
Quote:
|
Quote:
PHP Code:
|
Quote:
|
| All times are GMT. The time now is 05:22 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0