Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Formatting age
jfreak53
Ok, so what I need to do is format a date that comes from my DB like this:<br />
<br />
<blockquote class='ipsBlockquote' ><p>1992-10-19 00:59:43</p></blockquote>
<br />
I need to reformat that into this:<br />
<br />
<blockquote class='ipsBlockquote' ><p>17 Years 3 Months 24 Days</p></blockquote>
<br />
Now I know there is probably not a formatting function that will figure this out since it has to be calculated manually. But since I'm a PHP programmer I don't even know where to start or what to do once I'm there ha ha.<br />
<br />
Any thoughts?
Find more posts tagged with
Comments
mwilliams
You could use that date and today's date to find the difference in years using the diffYear() BIRT function, take the floor value of that to make the years part. Take the diffMonth() value, take the floor of that and subtract years * 12 from it, you now have months. Finally, take the difference in days with diffDay() function using today's date and a date you build that is lastMonth/yourDate'sDate/thisYear and you have your days. Now you just have to build the string with those values. Hope this makes sense. Let me know if you have questions.
jfreak53
Beautiful! I got to say I looked through BIRT functions and never saw those three. Thanks, all working.