方法一:
SYSTEMTIME st;
GetLocalTime(&st);
方法二:
// asdfasdf.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <Windows.h>
#include <iostream>
#include <time.h>
#include <locale.h>
int _tmain(int argc, _TCHAR* argv[])
{
time_t rawtime;
time(&rawtime);
struct tm * timeinfo = localtime(&rawtime);
int twice = 0;
char buffer[MAX_PATH] = {0};
int nNum = strftime(buffer, MAX_PATH, "%c", timeinfo);
struct lconv *lc;
do
{
printf("Local is : %s\n", setlocale(LC_ALL, ""));
int nNum = strftime(buffer, MAX_PATH, "%c", timeinfo);
printf("date is : %s\n", buffer );
lc = localeconv();
printf("currentcy symbol is : %s\n-\n", lc->currency_symbol);
setlocale(LC_ALL, NULL);
} while(!twice++);
return 0;
}