Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!peruvian.utah.edu!bwilliam From: bwilliam%peruvian.utah.edu@cs.utah.edu (Bruce R. Williams) Newsgroups: comp.lang.c Subject: Re: Date reading in C... Keywords: system date, Turbo C Message-ID: <1991Feb3.224845.29603@hellgate.utah.edu> Date: 4 Feb 91 05:48:45 GMT References: <1991Feb2.193758.7570@cs.dal.ca> Distribution: na Organization: University of Utah CS Dept Lines: 32 In article <1991Feb2.193758.7570@cs.dal.ca> dinn@ug.cs.dal.ca (Michael Dinn) writes: >I need some C code that will give me the variables month, day and year >as being set to the current month day and year. (time would be >nce as well as the date...) > > Examples of any sort would be welcomed... This is a very system-specific question. Here is an example using Turbo C 2.0 on an AT: -Bruce ------------------ /* Retrieve and display the system date */ /* Written by Bruce R. Williams */ #include #include main() { struct date dt; char *month[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; getdate(&dt); printf("Today is %s %d, %d\n",month[dt.da_mon - 1],dt.da_day,dt.da_year); } Bruce R. Williams "The most beautiful thing we can experience University of Utah is the mysterious. It is the source of all (bwilliam@peruvian.utah.edu) true art and science." -Albert Einstein