Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any good guides for time conversions?

Status
Not open for further replies.

ITCPhil

Technical User
Jun 30, 2005
181
CA
I am still fairly knew to Crystal and while some of it is quite simple, I am having all sorts of problems with dates and time. The helpfile is somewhat useful and searching here usually also helps, but I'd like to find a good FAQ/Tutorial on the conversion of time periods (versions 8.5-11).

I'd like to read up on simple information, when to use truncate, when to use remainder, mod, "##" or "00", what those all mean etc... and also the more detailed information such as converting a number of seconds to days, hours, minutes, seconds but only showing them when needed (so that 30 seconds does not appear as 00:00:00:30).

Sure, I can copy formulas I get from other people, but without understanding what they mean, I am never going to improve at CR.

Would anyone have a good place for me to go for this?

Thanks in Advance,
Phil

 
Hi,
Much of what you want is in the CR help file..Just not all in one place,sadly.Also look at the FAQs for this forum..

Some of the other stuff is very database dependent, since they all handle Date and DateTime ( and Timestamp) fields differently, and, therefore, may require different formulae..




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
As far as datetime, just right click on the field object and click on format field. Click on the date/time tab and select the option you want or click on the customise button and set the way you want.

For days, hours, minutes, and seconds, see
-lw
 
Thanks for the answers. For the Ken Hamady thing, I get the gyst of it, but I just don't understand why some use truncate, others use remainder and those (I had that one bookmarked). I will need to go into the help file and try to see what they mean and their possible uses.

I was asking because I had this formula my coworker I am replacing which while it works in its own report did not work in mine and I couldn't figure out why (I got it to work without using it) - it's quite a bit longer than most of what I see in texts like Ken Hamady's document.
IF ToText (truncate((Average ({@Life Cycle seconds}, {@Regions including invalid group names})/30600)),"0") IN ['0','1'] AND
NOT(ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 30600)/3600)),"0") IN ['0','1']) THEN
ToText (truncate((Average ({@Life Cycle seconds}, {@Regions including invalid group names})/30600)),"0") + ' day, ' +
ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 30600)/3600)),"0") + ' hrs, ' +
ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 3600)/60)),"0") + ' min'
ELSE IF NOT(ToText (truncate((Average ({@Life Cycle seconds}, {@Regions including invalid group names})/30600)),"0") IN ['0','1']) AND
ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 30600)/3600)),"0") IN ['0','1'] THEN
ToText (truncate((Average ({@Life Cycle seconds}, {@Regions including invalid group names})/30600)),"0") + ' days, ' +
ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 30600)/3600)),"0") + ' hr, ' +
ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 3600)/60)),"0") + ' min'
ELSE IF ToText (truncate((Average ({@Life Cycle seconds}, {@Regions including invalid group names})/30600)),"0") IN ['0','1'] AND
ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 30600)/3600)),"0") IN ['0','1'] THEN
ToText (truncate((Average ({@Life Cycle seconds}, {@Regions including invalid group names})/30600)),"0") + ' day, ' +
ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 30600)/3600)),"0") + ' hr, ' +
ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 3600)/60)),"0") + ' min'
ELSE
ToText (truncate((Average ({@Life Cycle seconds}, {@Regions including invalid group names})/30600)),"0") + ' days, ' +
ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 30600)/3600)),"0") + ' hrs, ' +
ToText (truncate(((Average ({@Life Cycle seconds}, {@Regions including invalid group names}) mod 3600)/60)),"0") + ' min'

 
What functions you use depends on what you are trying to achieve in your report and no one here knows that but you unless you explain what you are trying to accomplish. Only then can we point you in the right direction.

Click on Help and click on the Index tab and enter the function to find out more information.
 
What I can do changes in every report... some managers require a date time while others require business time accounting for holidays and daylight savings..., I am going as general as I can with this post.
 
((I'm also gone for the weekend now so can't post until Monday))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top