wcsftime - C wchar.h

C examples for wchar.h:wcsftime

Type

function

From


<cwchar>
<wchar.h>

Description

Format time as wide string

Prototype

size_t wcsftime (wchar_t* ptr, size_t maxsize, const wchar_t* format,
                 const struct tm* timeptr);

Parameters

Parameter Description
ptr the destination array
maxsize Maximum number of wide characters to copy.
format a format string as format in strftime.
timeptr a tm structure.

Return Value

On success, the total number of characters copied to ptr is returned.

Otherwise, zero is returned.

Demo Code


#include <wchar.h>
#include <time.h>

int main ()//  w  w  w. j  a v  a  2s  .  co m
{
  time_t rawtime;
  struct tm * timeinfo;
  wchar_t buffer [80];

  time ( &rawtime );
  timeinfo = localtime ( &rawtime );

  wcsftime (buffer,80,L"Now it's %I:%M%p.",timeinfo);
  wprintf (L"%ls\n",buffer);

  return 0;
}

Related Tutorials