Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

convert seconds to time(am/pm)

Posted on 2004-09-13
4
Medium Priority
?
357 Views
Last Modified: 2013-12-24
I have the seconds in 55800 format which is 15.5 (3.30pm).
Is there a way to write fn to output this as 3.30pm
thanks
0
Comment
Question by:anusha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 100 total points
ID: 12048385
Yes - do the math



<cfset currentsec = 55800>

<cffunction name="getTime">
<cfargument name="mysec" type="numeric" required="true">

<cfset mymin = mysec / 60>

<cfset myhours = mymin / 60>

<cfset timeHours = ListFirst(myhours, '.')>
<cfset timeminutes = ListLast(myhours, '.') * 60>

<cfset thetime = timeHours & ":" & timeminutes>
<cfif timeHours GTE 12>
   <cfset thetime = thetime & " pm">
<cfelse>
   <cfset thetime = thetime & " am">
</cfif>

<cfreturn thetime>
</cffunction>
0
 
LVL 10

Accepted Solution

by:
Mause earned 100 total points
ID: 12051786
hi,

mrichmon some small changes:

<cffunction name="getTime">
<cfargument name="mysec" type="numeric" required="true">

<cfset timesec = mysec mod 60>
<cfset timemin = ((mysec - timesec) mod 3600) / 60>
<cfset timehour = (mysec - (timemin*60)) / 3600>

<cfreturn createtime(timehour, timemin, timesec)>
</cffunction>


Mause
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12055350
Yeah that is better, but I was writing quick :o)

Use Mause's solution.
0
 
LVL 10

Expert Comment

by:Mause
ID: 12056573
thx mrichmon

also did some quick writing ;)

why not split the points

0

Featured Post

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
What You Need to Know when Searching for a Webhost Provider
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question