If you count your time spent in the garden, and make the assumption that you could be earning your normal salary if you weren't gardening, then it is very likely that this is a losing proposition financially. My wife and I rarely calculate in our time spent on things (outside of work) as worth anywhere close to what we'd make at our jobs, since we believe it's unreasonable to expect people would pay us our salaries outside of the normal working hours. Also, my wife LOVES gardening, so even if it was a totally losing proposition (like she lost an entire garden and it cost us $300) it'd still be worth the expense for her enjoyment of the hobby. PLUS, there was a LOT of exercise involved, so it was good for our health.
The VERY short answer is in our case, we probably spent $300-400 dollars MINIMALLY on our garden (only garden), and we probably earned back significantly more than that in pure produce output.
For the longer answer, let me tell you about OUR garden this year. I promised my wife a garden in years past, and was going to be damn sure it was a success so our up front expenses were high, as was our time invested. You need to be honest about your skills up front, if you have ever said you had a "brown thumb" you're going to be putting in more time learning things (but can still have a successful garden). My wife has a reasonable amount of experience with plants, but honestly, ANYBODY can do it if they are willing to learn and invest the time.
To start, you need to decide where you're going to have a garden. You need to decide how much sun is right (depending on what you want to grow). You need to decide if your garden will be in the ground, in raised beds, pots, etc. My wife wanted a big garden (Three 4'x16' rows) and I told her I wasn't on board with anything other than in the ground. (Raised bed costs can be cheap to expensive depending on your level of skill and desired end product... Also if you have soil handy, or a good place to excavate it, or if you need to buy it) Since we went with in the ground, we needed a way to get the soil ready.
I have a small garden tractor so I simply put on a rototiller and turned the bare ground to start (one of the reasons I opted for "directly in ground"). Then my wife tested the soil, and bough amendments as needed. (If soil had been horrible, we'd have needed to rototill amendments in, she was able to get by with fertilizers that were applied topically) Cost to set up earth was $0 due to good soil, but we probably spend $50 for fertilizers...though we could have done without, production was definitely worth the money.
Next, if you have animals that are going to decimate your crops (we have TONS of rabbits AND deer around) you'll need to stop that from happening. With rabbits, I decided that meant chicken wire fence, buried into the ground 1 foot and out 1 foot so they would not dig underneath it. Also had to be 3 feet high (for me to feel sure they'd stay out). This was a LOT of initial time & effort, but was totally worth it. Total cost for this was probably around $100 since the garden was 21' x 29'.
Next, my wife spent lots of time planning her garden. She used the square foot method, which I guess was all-right, but I felt like it was too intensive for the ground. If you've got the area, I find good old fashioned spacing works well. What you definitely need to figure out is where you want to put things. Some crops do well planted close to others, some will cross breed if too close. Some crops need light, some don't need as much. Corn should be planted in a manner that allows the seeds to properly pollenate (usually 3 rows... though we found planting on a corner worked... okay) Then she bought all the seeds she needed (probably at least $50 worth of seeds. Those things are expensive!!!)
Once she planted the seeds, we COULD have relaxed and left all's well alone. BUT... every year previous, she had lost her crops to us traveling on the weekends, and not being around to water them. EVERY...SINGLE...YEAR. We could have paid somebody, or asked a neighbor, but we travel often and I was determined her garden would be a success so I bought a water timer, garden hoses, backflow preventor, valves/splitters and soaker hoses that we rigged up to automatically water the garden. This also made it easier to not worry, and was one less thing to do on a daily basis. This setup cost us another $100 (at least) + however much water we used over the summer. It also took us quite a few hours to get everything set up and adjusted for us to trust that we wouldn't return home to a flooded yard, or ruined garden.
We spent a lot of time weeding up front, and when the weeds started to slow down, we found ourselves spending almost as much time HARVESTING things. We had to build some simple trellises for tomatoes. We also had to deal with some minor fungus & bug issues which we solved by purchasing an insecticide and fungicide. (I do NOT recommend going fully organic/chemical free/pesticide free Others may but I am a fan of quick, simple, affordable, and high success rate. I think anything I grow myself is better than what I buy at the store anyway) Total cost maybe $50 for fungicides at most.
Now our garden produced TONS of produce. Too much. We started freezing, but were filling up our freezers. So onto our next expense, my wife took up canning. (Water bath AND pressure canning, depending often on the acidity of the veggies) She canned some beans, plenty of tomatoes and tomato based things, and other things that weren't garden related (leftover ham bone = pea soup) This expense was probably another $100+. Would have been more if we didn't already have a pressure cooker. Honestly though, we would be hard pressed to eat everything before it started going bad had she not taken up canning... Unless we purchased a food saver or something to help extend the freezer life. Either way eating EVERYTHING coming out of your garden will probably require some form of long term storage.
I hope you don't read all of this and think I'm telling you NOT to garden. In fact, I am saying the exact opposite. Most of our expenses were "up front". The garden (if not for my garage coming in the spring) is still there, and doesn't need much to be changed for next year. The watering set up is great, just need some new soaker hoses and the rest is good to go. The trellis is still there. The canning supplies are an up front cost.
If you figure that we were able to be in the money the first year where we bought ALL the up front items, we'll be much further ahead in future years. You did ask about the time, so I wanted to be honest about that as well. You can be as involved or not as you want, but I will tell you that for a big garden like we had, there is a LOT of time involved. We ate almost exclusively out of the garden (excluding meat) for a good portion of the summer. We learned valuable skills that we'll be able to use forever, and we ate significantly healthier than we otherwise would have. When I get home, I'll see if I can tally up some of what we produced, however we kinda got sick of weighing things.