Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Run a function in a specific time


nikita

Recommended Posts

Hey, community!

I've surfed the forum for two days to find was there a topic about "Running a function in a specific time". Unfortunately, I haven't found anything I need.

 

So there is a new topic by me where I'd like to ask about it:

- How to ask php to run a function on a specific time (based on server time) every day?

 

I'm inserting my country credit card payment method. Transactions, which I get through all day should be closed every day - that's bank rule. This function named closeDay(); And so it is not so easy to push the button every day to get this function running. So thats why I'm asking about this!

 

Could you help, please?

Thanks a lot for all our community members. It's amazing that we are together and we have opportunity to help each oher.

Link to comment
Share on other sites

Try searching for cron jobs in the contributions.

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

You could use

 

$current_time = strtotime(date('Hi'));

 

if (strtotime('1200') == $current_date) {do function}

 

 

B)

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

You could use

 

$current_time = strtotime(date('Hi'));

 

if (strtotime('1200') == $current_date) {do function}

 

B)

Could you please explain this?

Thanks a lot for all our community members. It's amazing that we are together and we have opportunity to help each oher.

Link to comment
Share on other sites

Sorry, there was an error, it should be:

 

$current_time = strtotime(date('Hi'));

 

if (strtotime('1200') == $current_time) {do function}

 

but no doublt you spotted that:

 

What it does:

 

date('Hi') get current local time in hours & minutes, or server time if no variation set.

 

strtotime: parse that date/time format into a Unix timestamp

 

then compare your two timestamps, if same run your function.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...