How can I get the date and time from PC from the Arduino code?

I am doing a project that makes a table of data, but I want the arduino to print the exact date and time that is in the computer, before it starts to recieve data. So I just want a command or something from the library Time, that gives me the date and time, I don't need all the code to sync the hour more that one time.

Look at the real time clock example in the IDE. It is designed to auto set a RTC chip but it has to get the data to do that first from the PC, which is what you want.

Since you have to be connected to the computer to get the time therefrom, you might find it simpler to send the data to the computer instead. You can do this with any freebie terminal. This saves you the problem of extracting the time from the PC, no need for an RTC, and no need for an SD card either.