home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
463.lha
/
Date_routines
/
natldate.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-01-04
|
1KB
|
46 lines
/*****
natldate()
This function returns the date in different formats.
Argument list: char *buff to hold the resulting date string
int month the month
int day the day
int year the year
int sep the character used to separate dates
int where which format to use:
0 = US mm/dd/yy
1 = Europe dd/mm/yy
2 = Japan yy/mm/dd
Return value: void
*****/
#include <stdio.h>
#include <string.h>
void natldate(char *buff, int day, int month, int year, int sep, int where)
{
char form[20];
while (year > 100)
year -= 100;
strcpy(form, "%02d%c%02d%c%02d"); /* Zero padding */
switch (where) {
case 0: /* US */
sprintf(buff, form, month, sep, day, sep, year);
break;
case 1: /* Europe */
sprintf(buff, form, day, sep, month, sep, year);
break;
case 2: /* Japan */
sprintf(buff, form, year, sep, month, sep, day);
break;
default: /* Default is US */
sprintf(buff, form, month, sep, day, sep, year);
break;
}
}