backDate


Say, does anyone know how to exctract the date and time so I can output it back to the user?

Use the library function `strftime'. It is described in the libc reference docs.

strftime

Syntax

 #include 
     
 size_t strftime(char *buf, size_t n, 
		 const char *format, const struct tm *time);
Description
This function formats the given TIME according to the given FORMAT and stores it in BUF, not exceeding N bytes.

The format string is like `printf' in that any character other than `%' is added to the output string, and for each character following a `%' a pattern is added to the string as follows, with the examples as if the time was Friday, October 1, 1993, at 03:30:34 PM EDT:

`%A' The full weekday name (`Friday')
`%a' The abbreviated weekday name (`Fri')
'%B' The full month name (`October')
`%b'
`%h'
The abbreviated month name (`Oct')
`%C' Short for `%a %b %e %H:%M:%S %Y' (`Fri Oct 1 15:30:34 1993')
`%c' Short for `%m/%d/%y %H:%M:%S' (`10/01/93 15:30:34')
`%e' The day of the month, blank padded to two characters (` 2')
`%D' Short for `%m/%d/%y' (`10/01/93')
`%d' The day of the month, zero padded to two characters (`02')
`%H' The hour (0-24), zero padded to two characters (`15')
`%I' The hour (1-12), zero padded to two characters (`03')
`%j' The Julian day, zero padded to three characters (`275')
`%k' The hour (0-24), space padded to two characters (`15')
`%l' The hour (1-12), space padded to two characters(` 3')
`%M' The minutes, zero padded to two characters (`30')
`%m' The month (1-12), zero padded to two characters (`10')
`%n' A newline (`\n')
`%p' AM or PM (`PM')
`%R' Short for `%H:%M' (`15:30')
`%r' Short for `%I:%M:%S %p' (`03:30:35 PM')
`%S' The seconds, zero padded to two characters (`35')
`%T'
`%X'
Short for `%H:%M:%S' (`15:30:35')
`%t' A tab (`\t')
`%U' The week of the year, with the first week defined by the first Sunday of the year, zero padded to two characters (`39')
`%W' The week of the year, with the first week defined by the first Monday of the year, zero padded to two characters (`39')
`%w' The day of the week (0-6) (`5')
`%x' Short for `%m/%d/%y' (`10/01/93')
`%y' The year (00-99) of the century (`93')
`%Y' The year, zero padded to four digits (`1993')
`%Z' The timezone abbreviation (`EDT')
`%%' A percent symbol (`%')

Return Value
The number of characters stored.

Example

     struct tm t;
     char buf[100];
     strftime(buf, 100, "%B %d, %Y", &t);