Welcome Guest, Not a member yet? Register   Sign In
how to trim timespan()
#11

[eluser]Thorpe Obazee[/eluser]
lol. uberfuzz just made my post pointless Smile
#12

[eluser]xwero[/eluser]
What is it what you want? When i read
Quote:i need to trim down the result of timespan()...

so if the interval totals to a day(s)
I read that as wanting to transform 6 Days, 8 Hours, 7 Minutes to 6 Days. Which means you have to alter the function to define the last time segment to output.

When i read
Quote:it will only show the day
I interpret it you want to get the time segments individually. For that you could alter the function to output an array instead of a string because it would be inefficient to call the function as many times as there are time segments. But this last solution brings with it a whole bunch of checks.
#13

[eluser]xwero[/eluser]
überfuzz's solution only works with static dates. As soon as the date goes over a month a segment is added and the part you want to display is moved.
#14

[eluser]überfuzz[/eluser]
[quote author="bargainph" date="1241528805"]lol. uberfuzz just made my post pointless Smile[/quote]
Eh or vice versa, when I posted the lines with explode the idea was to keep it stupid simple. His nick is newbie after all. He'll get to the fancy stuff in time.
#15

[eluser]überfuzz[/eluser]
[quote author="xwero" date="1241530518"]überfuzz's solution only works with static dates. As soon as the date goes over a month a segment is added and the part you want to display is moved.[/quote]
Spot on!
#16

[eluser]Dam1an[/eluser]
But could you not use a simple check to make sure the part you're returning is really want you want? Although once you start hacking on checks like that, then maybe it isn't the most elegant solution
#17

[eluser]Thorpe Obazee[/eluser]
We'll probably wait until he gets back on to know what he really wants.
#18

[eluser]newbie boy[/eluser]
thanks überfuzz...

finally found the solution...

good thinking man...

thanks again.....

until next time....
#19

[eluser]überfuzz[/eluser]
[quote author="newbie boy" date="1241533520"]finally found the solution...[/quote]
It'll work, but it has some limitations. Read some of the posts and you understand.

Good luck!




Theme © iAndrew 2016 - Forum software by © MyBB