home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ccicpg!felix!fritz!scotth
- From: scotth@felix.filenet.com (Scott Hopson)
- Newsgroups: comp.lang.c
- Subject: Re: Finding date/time
- Message-ID: <19072@fritz.filenet.com>
- Date: 25 Jul 92 01:00:45 GMT
- References: <1992Jul22.150108.19427@news.uakron.edu>
- Reply-To: scotth@fritz.filenet.com (Scott Hopson)
- Organization: FileNet Corp., Costa Mesa, CA
- Lines: 26
-
- In article <1992Jul22.150108.19427@news.uakron.edu> r3kls@vax1.cc.uakron.edu (Kevin L Sheller) writes:
- >I'm using ANSI C on a UNIX Sun Station. I need to know how to access the
- >current date and time in my program.
- >
- > If you've gotta good idea, please e-mail me at: kevins@file02.ecgf.uakron.edu
- >
-
- You might try reading the manual. Try "man -k time"
-
- here's an example, hope it's what you want.
-
-
- #include <time.h>
-
- long t;
- char *time_date;
-
- t = time(NULL); /* gets time in seconds since 00:00:00 GMT 1970 */
- time_date = ctime(&t); /* converts time to a string with time & date */
-
- printf("%s",time_date);
-
-
- Good Luck.....
- --
- Scott Hopson (scotth@filenet.com)
-