xref: /reactos/sdk/lib/crt/time/strdate.c (revision 1734f297)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS CRT library
4  * FILE:        lib/sdk/crt/time/strdate.c
5  * PURPOSE:     Fills a buffer with a formatted date representation
6  * PROGRAMER:   Ariadne
7  * UPDATE HISTORY:
8  *              28/12/98: Created
9  */
10 #include <precomp.h>
11 
12 /*
13  * @implemented
14  */
15 char* _strdate(char* date)
16 {
17    static const char format[] = "MM'/'dd'/'yy";
18 
19    GetDateFormatA(LOCALE_NEUTRAL, 0, NULL, format, date, 9);
20 
21    return date;
22 
23 }
24 
25 /*
26  * @implemented
27  */
28 int CDECL _strdate_s(char* date, size_t size)
29 {
30     if(date && size)
31         date[0] = '\0';
32 
33     if(!date) {
34         *_errno() = EINVAL;
35         return EINVAL;
36     }
37 
38     if(size < 9) {
39         *_errno() = ERANGE;
40         return ERANGE;
41     }
42 
43     _strdate(date);
44     return 0;
45 }
46