Time-Sensitive code

How do i run a certain block of code at a specific time.

For example, i want to do a specific task at 9:38 pm, how would i do that?

With an RTC. From there it is options all the way down.

Without an RTC, the Arduino has no idea what time it is, so it can't make something happen at 9:38 PM.

Is their anyway for the arduino to get the get time from the computer itself?Do i need an rtc?

get time from the computer itself?

Not easily.

Use an RTC. The DS3231 modules work very well.

Is their anyway for the arduino to get the get time from the computer itself?

Yes, but that requires a program on the PC, running all the time, that can respond to requests for time.

If you are going that route, you might as well have the program in the PC handle knowing when to make the Arduino do whatever needs doing. Then, the PC application can just send "Hey, stupid, wake up; get busy" to the Arduino at the appropriate time.

The Arduino can then store and parse the serial data, find out that it has been insulted, and sulk for a while before doing whatever needs doing.

Or, you could send something simpler to parse, and less insulting.

The RTC is cheaper, and easier to use, than a PC.