Click to See Complete Forum and Search --> : Echo present Date & Time


LA Gator
10-24-2001, 02:16 PM
Hi,

I'm really glad I found this site (the NHFs are great!).

I've searched a bunch trying to find the answer for this with no success, so I'm reluctantly posting this call for help.

I want to echo the time and date when I run a simple program that counts items in my database. That way, I'll know what changed over what period of time. I thought I found the answer in Info Echo, but I couldn't get echo '%H' to echo the current hour.

Is the answer right under my nose?

Thanks in advance!

LA G

thor420
10-24-2001, 03:20 PM
What kind of database? MySQL?

LA Gator
10-24-2001, 03:28 PM
It is just a comma delineated file I created. I periodically check the count and would like to remember the time of the previous count by echoing it to the screen with the count.

bdg1983
10-24-2001, 04:18 PM
echo `date`

The " ` " beside the # 1 key.

X_console
10-24-2001, 04:22 PM
LA Gator: date and echo `date` have the same output, so I'm not sure why you just don't use date?

posterboy
10-24-2001, 04:22 PM
I'm kinda confused too, but, the command that prints the time to the screen is "date". Using awk, like date |awk '{print $4}' you can just print the time, or any of the pieces of that string. date itself has a format string that allows this kind of thing, but i always just use awk, as the formatting seems more complicated to me. Or is that what you are looking for at all? Ray

LA Gator
10-24-2001, 05:16 PM
Thanks all!

I understood everything except the last awk stuff.

I can just use date and that works great.

Thanks again!

ppmnt
10-24-2001, 05:17 PM
Do a 'man date' and read the man file. There are many options for how to format the date. For example: date '+%m%d%y' will give you this format: 102401 good for naming files or such.

ppmnt http://www.plauder-smilies.de/tales/heks.gif