Jump to content

How can I add a one-time x amount in y after a specified time automatically?


raahimfareed

Recommended Posts

Let's say I am buying a share for $10.

If I sell the share on the same day BEFORE 3:30PM, it will be sold for $10, but if I keep the share past 3:30PM, I want the code to automatically add $1 (Taxes and such) once in the the price of the share in database, after that no matter how many days pass by, the price will remain the same.

 

I've thought about CRON jobs, but I have no idea how to make/use them or set them up.

 

Any direction or help is appreciated.

 

 

Link to comment
Share on other sites

18 minutes ago, requinix said:

You don't have to change anything. Whatever your code is that looks up the amount, update it so that it takes the time into account and adds $1 if it's after 3:30.

So, if I understand that right, when the page loads, (refreshes) it checks the time and if the time is past the specified time, it adds the amount?

Edited by raahimfareed
Typo
Link to comment
Share on other sites

Yeah. It's a distinction between an original amount and an effective amount. It's $10 originally and +$1 for the time-based fee thing I don't know for an effective amount of $11.

Now, this should all be handled in a single place, so it's not like the page itself is doing this work, but yes: the code starts with the original $10 and then recognizes that it should +$1 because of the time.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.