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 6946467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:34:08+00:00 2026-05-27T13:34:08+00:00

I have a cronjob that calls a PHP file via CURL every hour from

  • 0

I have a cronjob that calls a PHP file via CURL every hour from one of my computers. When the file is called, the PHP code retrieves the server time, since it should record it in a database field in HH:MM format.

Client and server are not perfectly synced, so, when the client calls the PHP file, it can happen that for the client it’s 14 o’clock, while for the server it’s still 13:59. 13:59 is not acceptable for my db, since I should have always 14:00, 15:00, 16:00 and so on.

I can’t send parameters via CURL because of an unsolved issue with time and my computer AND I can’t change the server time.

The only thing I could try is to adjust the time retrieved from PHP, and, when it’s 13:59 (or even 14:01), adjust and save it as 14:00. Is there any PHP magics to solve this problem? My idea is to convert the time to 13,59 (or 14,01), then round them in some way, but maybe there are better options.

Any help is appreciated.

  • 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-27T13:34:09+00:00Added an answer on May 27, 2026 at 1:34 pm

    The simplest way to get the nearest hour in an HH:MM format string that I can think of is:

    FIXED (again)

    $nearest_hour = str_pad(round(date('H') + ((date('i') - 1) / 60)),2,'0',STR_PAD_LEFT).':00';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP page that I run every minute through a CRON job.
I have a cronjob that runs every hours and parse 150,000+ records. Each record
I have a cronjob, that kicks in every 5 minutes. It should do some
I have a simpleXML file that is being generated from a rest api call
i have a cronjob in php that calculates few business rules (eg: net rev,
I have written the cronjob that runs each hour. Can we anyway stop the
I have a cronjob calling a shell script. Inside that shell script and I
If I have a cron job that run every 10 minutes and for some
I have a CRON job php script that I just set up not too
Have a SomeLib.pro file that contains: CONFIG += debug TEMPLATE = lib TARGET =

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.