home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
word2x0a.zip
/
source
/
ukdate.cc.orig
< prev
next >
Wrap
Text File
|
1997-04-13
|
1KB
|
60 lines
/* $Id: ukdate.cc,v 1.3 1997/04/13 01:46:24 dps Exp dps $ */
/* Date formatter for the UK */
#include "config.h"
#ifdef TM_IN_SYS_TIME
#include <sys/time.h>
#else
#include <time.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else /* do not have sting.h */
#include <strings.h>
#endif /* HAVE_STRING_H */
#define __EXCLUDE_READER_CLASSES
#include "lib.h"
char *uk_date(time_t when)
{
static const char *months[]=
{
"Janurary", "Februrary", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December",
};
struct tm *tim;
char date_buf[200];
const char *postfix;
tim=localtime(&when);
switch (tim->tm_mday % 10)
{
case 1:
postfix="st";
break;
case 2:
postfix="nd";
break;
case 3:
postfix="rd";
break;
default:
postfix="th";
break;
}
sprintf(date_buf, "%d%s %s, %d", tim->tm_mday, postfix,
months[tim->tm_mon], 1900+tim->tm_year);
return strdup(date_buf);
}