Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   strftime.3p    ( 3 )

преобразовать дату и время в строку (convert date and time to a string)

Примеры (Examples)

Getting a Localized Date String
       The following example first sets the locale to the user's
       default. The locale information will be used in the nl_langinfo()
       and strftime() functions. The nl_langinfo() function returns the
       localized date string which specifies how the date is laid out.
       The strftime() function takes this information and, using the tm
       structure for values, places the date and time information into
       datestring.

#include <time.h> #include <locale.h> #include <langinfo.h> ... struct tm *tm; char datestring[256]; ... setlocale (LC_ALL, ""); ... strftime (datestring, sizeof(datestring), nl_langinfo (D_T_FMT), tm); ...