how do i make it so where it will type good afternoon at 12:00 pm please tell me i would be happy and if you do thanks for the help
Replit doesn’t have a feature to run the code at a set time. You didn’t say which language you’re using but what you’re going to need is this:
- A Repl which is either Always On or Deployed
- A code which runs a forever loop
- Inside this forever loop, a function checks the current time
- Inside this forever loop, if the current time matches a given time, execute a certain function
I would put a delay between time queries so that it isn’t constantly checking the time. Maybe check once a minute or something. The reason why time checking is necessary is because even Replit’s most reliable methods of keeping a Repl on will not guarantee 24/7/365 uptime, and so it cannot rely on simple delays and counters to keep time.
can you like show me a photo for an example
A photo of what? Screenshot? Could you tell me what language you want to use and I’ll determine whether or not I know how for that language?
english that’s the language
What programming language? Python? JavaScript? C++?
No but you can do that with code. Depending on the programming language. In Python there’s a schedule
module.
im sure it is java script
how do i check it again
Front end (website) or back end (NodeJS)?
Your Repl should say although the key words and syntax should provide a good clue. Looking at your profile your only Repl is NodeJS.
well i don’t know much so i don’t know what your talking about?
Frontend JavaScript (JS) is what runs on a website when you load it, click buttons on it, etc. Backend JS runs in the terminal and is used to host servers. The only project I see on your Replit profile is NodeJS which is a backend JS.
now i remember yes it is node js
yes that one and also your very good at coding im sure
Use the node-cron
library
const cron = require('node-cron');
cron.schedule('0 12 * * *', () => {
console.log('Good afternoon');
});
Runs in the timezone the server is set in.
For specific timezones
const cron = require('node-cron');
cron.schedule('0 12 * * *', () => {
console.log('Good afternoon');
}, {
scheduled: true,
timezone: "America/New_York"
});
The server is probably in California. I’d use the code that allows you to specify the timezone.
ok ig let’s see soon😀