update for HEAD-2003091401
[reactos.git] / lib / msvcrt / time / wstrdate.c
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS system libraries
4  * FILE:        lib/msvcrt/time/strtime.c
5  * PURPOSE:     Fills a buffer with a formatted date representation
6  * PROGRAMER:   Boudewijn Dekker
7  * UPDATE HISTORY:
8  *              28/12/98: Created
9  */
10 #include <msvcrt/time.h>
11 #include <msvcrt/stdio.h>
12 #include <msvcrt/errno.h>
13 #include <msvcrt/internal/file.h>
14
15
16 /*
17  * @implemented
18  */
19 wchar_t* _wstrdate(const wchar_t* datestr)
20 {
21     time_t t;
22     struct tm* d;
23     wchar_t* dt = (wchar_t*)datestr;
24
25     if (datestr == NULL) {
26         __set_errno(EINVAL);
27         return NULL;
28     }
29     t = time(NULL);
30     d = localtime(&t);
31     swprintf(dt,L"%d/%d/%d",d->tm_mday,d->tm_mon+1,d->tm_year);
32     return dt;
33 }