Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6031387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:10:35+00:00 2026-05-23T05:10:35+00:00

I’ve heard that it’s possible to accomplish this using the modulus % operator present

  • 0

I’ve heard that it’s possible to accomplish this using the modulus % operator present in most programming languages. The real question is, how? I’m unfamiliar with how modulus works, so I’ve had difficulties using it in the past. Given the present time here in seconds since 1970, 1307758473.484, how can I calculate how many years that is, days that is, hours that is, and minutes that is using modulus?

I’m essentially looking to format it like this: “5 years, 10 days, 12 hours, 7 minutes, and 18.56 seconds”. How would I do this? I’m really interested in learning the logic behind this and not interested in a simple drop-in solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T05:10:36+00:00Added an answer on May 23, 2026 at 5:10 am

    When you do integer division, you get quotient and remainder. For example,

    5 divided by 3 is quotient 1 with remainder 2.
    

    In programming languages, this is usually expressed as:

    5 / 3   # => 1
    5 % 3   # => 2
    

    The conversion you want is just a repeatation of this. It’s easier to to start from the lower unit and go higher on.

    First, you have

    • 1307758473.484 seconds

    Since 60 seconds is 1 minute, and

    1307758473.484 / 60 = 21795974  (intended to be integer division)
    1307758473.484 % 60 = 33.484,
    

    it is the same as

    • 21795974 minutes 33.484 seconds

    Since 60 minutes is 1 hour, and

    21795974 / 60 = 363266
    21795974 % 60 = 14
    

    it is further the same as

    • 363266 hours 14 minutes 33.484 seconds

    Now, there is a little bit of difficulty. Most days are 24 hours. When there is a leap second, it is not. If you ignore leap seconds and assume 1 day is 24 hours, then, by doing the calculation,

    363266 / 24 = 15136
    363266 % 24 = 2
    

    it is further the same as

    • 15136 days 2 hours 14 minutes 33.484 seconds.

    Similarly, Most years are 365 days. When there is a leap day (year), it is not. If you ignore leap days and assume that 1 year is 365 days, then by doing the calculation,

    15136 / 365 = 41
    15136 % 365 = 171
    

    it is further the same as

    • 41 years 171 days 2 hours 14 minutes 33.483 seconds
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.