summaryrefslogtreecommitdiff
path: root/support/word2x/deHTMLdate.cc
blob: 638b98650e9f58de604f5579840a67503d6585e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Date formatter for German dates (in German)
// With correct a-umlaut in HTML encoding
// Note: Using escape sequences in the <title> tag is not *really*
//       defined. You may want to use deL1 for your HTML stuff
// 8/1998 jk
#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 *deHTML_date(time_t when)
{
    static const char *months[]=
    {
	"Januar", "Februar", "M&auml;rz", "April",
	"Mai", "Juni", "Juli", "August",
	"September", "Oktober", "November", "Dezember",
    };

    struct tm *tim;
    char date_buf[200];
    
    tim=localtime(&when);

    sprintf(date_buf, "%d. %s %d", tim->tm_mday,
	    months[tim->tm_mon], 1900+tim->tm_year);
    
    return strdup(date_buf);
}