这篇教程C++ GetDateFormat函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetDateFormat函数的典型用法代码示例。如果您正苦于以下问题:C++ GetDateFormat函数的具体用法?C++ GetDateFormat怎么用?C++ GetDateFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetDateFormat函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SaveSessionDateint SaveSessionDate(){ if (session_list[0] != 0) { int TimeSize = GetTimeFormat(LOCALE_USER_DEFAULT, 0/*TIME_NOSECONDS*/, NULL, NULL, NULL, 0); TCHAR *szTimeBuf = (TCHAR*)mir_alloc((TimeSize + 1)*sizeof(TCHAR)); GetTimeFormat(LOCALE_USER_DEFAULT, 0/*TIME_NOSECONDS*/, NULL, NULL, szTimeBuf, TimeSize); int DateSize = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0); TCHAR *szDateBuf = (TCHAR*)mir_alloc((DateSize + 1)*sizeof(TCHAR)); GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szDateBuf, DateSize); int lenn = (DateSize + TimeSize + 5); TCHAR *szSessionTime = (TCHAR*)mir_alloc(lenn*sizeof(TCHAR)); mir_sntprintf(szSessionTime, lenn, _T("%s - %s"), szTimeBuf, szDateBuf); char szSetting[256]; mir_snprintf(szSetting, "%s_%d", "SessionDate", 0); TCHAR *ptszSaveSessionDate = db_get_tsa(NULL, MODNAME, szSetting); db_set_ts(NULL, MODNAME, szSetting, szSessionTime); mir_free(szSessionTime); if (ptszSaveSessionDate) ResaveSettings("SessionDate", 1, g_ses_limit, ptszSaveSessionDate); if (szTimeBuf) mir_free(szTimeBuf); if (szDateBuf) mir_free(szDateBuf); } if (g_bCrashRecovery) db_set_b(NULL, MODNAME, "lastSaveCompleted", 1); return 0;}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:35,
示例2: MAKELCIDvoid CGitPropertyPage::Time64ToTimeString(__time64_t time, TCHAR * buf, size_t buflen) const{ struct tm newtime; SYSTEMTIME systime; LCID locale = LOCALE_USER_DEFAULT; if (!CRegDWORD(_T("Software//TortoiseGit//UseSystemLocaleForDates"), TRUE)) locale = MAKELCID((WORD)CRegStdDWORD(_T("Software//TortoiseGit//LanguageID"), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)), SORT_DEFAULT); *buf = '/0'; if (time) { TCHAR timebuf[MAX_STRING_LENGTH] = { 0 }; TCHAR datebuf[MAX_STRING_LENGTH] = { 0 }; _localtime64_s(&newtime, &time); systime.wDay = (WORD)newtime.tm_mday; systime.wDayOfWeek = (WORD)newtime.tm_wday; systime.wHour = (WORD)newtime.tm_hour; systime.wMilliseconds = 0; systime.wMinute = (WORD)newtime.tm_min; systime.wMonth = (WORD)newtime.tm_mon+1; systime.wSecond = (WORD)newtime.tm_sec; systime.wYear = (WORD)newtime.tm_year+1900; if (CRegStdDWORD(_T("Software//TortoiseGit//LogDateFormat")) == 1) GetDateFormat(locale, DATE_SHORTDATE, &systime, NULL, datebuf, MAX_STRING_LENGTH); else GetDateFormat(locale, DATE_LONGDATE, &systime, NULL, datebuf, MAX_STRING_LENGTH); GetTimeFormat(locale, 0, &systime, NULL, timebuf, MAX_STRING_LENGTH); *buf = '/0'; _tcsncat_s(buf, buflen, datebuf, MAX_STRING_LENGTH-1); _tcsncat_s(buf, buflen, _T(" "), MAX_STRING_LENGTH-1); _tcsncat_s(buf, buflen, timebuf, MAX_STRING_LENGTH-1); }}
开发者ID:545546460,项目名称:TortoiseGit,代码行数:35,
示例3: ChangeTipvoid ChangeTip(NOTIFYICONDATA* nid, SYSTEMTIME* time) { TCHAR *buf, *datef = _T("dddd yyyy.MM.dd"); HANDLE heap = GetProcessHeap(); size_t n; n = GetDateFormat(LOCALE_USER_DEFAULT, 0, time, datef, NULL, 0); buf = (TCHAR*)HeapAlloc(heap, HEAP_ZERO_MEMORY, n * sizeof(TCHAR)); GetDateFormat(LOCALE_USER_DEFAULT, 0, time, datef, buf, n); _stprintf_s(nid->szTip, 64, _T("%s %02d:%02d"), buf, time->wHour, time->wMinute); HeapFree(heap, 0, buf);}
开发者ID:alexmarsev,项目名称:traybin,代码行数:11,
示例4: parseLastSeenDatestatic TCHAR* parseLastSeenDate(ARGUMENTSINFO *ai){ if (ai->argc <= 1) return NULL; MCONTACT hContact = NULL; CONTACTSINFO ci = { 0 }; ci.cbSize = sizeof(ci); ci.tszContact = ai->targv[1]; ci.flags = 0xFFFFFFFF ^ (CI_TCHAR == 0 ? CI_UNICODE : 0); int count = getContactFromString(&ci); if (count == 1 && ci.hContacts != NULL) { hContact = ci.hContacts[0]; mir_free(ci.hContacts); } else { mir_free(ci.hContacts); return NULL; } TCHAR *szFormat; if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0)) szFormat = NULL; else szFormat = ai->targv[2]; SYSTEMTIME lsTime = { 0 }; char *szModule = SEEN_MODULE; lsTime.wYear = db_get_w(hContact, szModule, "Year", 0); if (lsTime.wYear == 0) return NULL; lsTime.wMilliseconds = 0; lsTime.wSecond = db_get_w(hContact, szModule, "Seconds", 0); lsTime.wMinute = db_get_w(hContact, szModule, "Minutes", 0); lsTime.wHour = db_get_w(hContact, szModule, "Hours", 0); lsTime.wDay = db_get_w(hContact, szModule, "Day", 0); lsTime.wDayOfWeek = db_get_w(hContact, szModule, "WeekDay", 0); lsTime.wMonth = db_get_w(hContact, szModule, "Month", 0); int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0); TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR)); if (res == NULL) return NULL; if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, res, len) == 0) { mir_free(res); return NULL; } return res;}
开发者ID:kmdtukl,项目名称:miranda-ng,代码行数:52,
示例5: CDialogExportGSASnapshot::ExportGSASnapshot(CString filename, CString title, CWnd* pParent /*=NULL*/) : CDialog(ExportGSASnapshot::IDD, pParent){ //{{AFX_DATA_INIT(ExportGSASnapshot) m_desc = _T(""); m_notes = _T(""); m_title = _T(""); //}}AFX_DATA_INIT m_title = title; m_filename = filename; char date[100]; char time[100]; GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, date, 100); GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, NULL, time, 100); m_desc.Format("%s %s", date, time);}
开发者ID:Brukwa,项目名称:VisualBoyAdvance,代码行数:27,
示例6: formatDatewstring formatDate(StringBuffer& date) { wstring dd(TEXT("")); wchar_t* wdate = toWideChar(date); if (wdate == NULL) { return dd; } wchar_t data[80]; wchar_t formatDate[80]; int found = 0; SYSTEMTIME timeDest; swscanf_s(wdate, L"%4d%2d%2d", &timeDest.wYear, &timeDest.wMonth, &timeDest.wDay); GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLONGDATE, data, 80); dd = data; if ((found = dd.find(TEXT("dddd, "))) != wstring::npos) { dd.replace(found, 6, TEXT("")); } else if ((found = dd.find(TEXT("dddd,"))) != wstring::npos) { dd.replace(found, 5, TEXT("")); }else if ((found = dd.find(TEXT("dddd"))) != wstring::npos) { dd.replace(found, 4, TEXT("")); } trim(dd); GetDateFormat(LOCALE_USER_DEFAULT, NULL, &timeDest, dd.c_str(), formatDate, 80); dd = formatDate; return dd;}
开发者ID:funambol-mirror,项目名称:funambol-windows-client,代码行数:29,
示例7: edfheader_to_physicalvoid edfheader_to_physical(EDFHEADERStruct * from, EDFHEADER_PHYSICALStruct * to){ int len,t; char * ch; SYSTEMTIME st; char actdate[10]; char acttime[10]; len=256+256*from->channels; ch=(char *)to; for(t=0;t<256;t++,ch++) *ch=' '; GetSystemTime(&st); // gets current time GetDateFormat(0, 0, &st, "dd.MM.yy" , actdate, 9);actdate[8]=0; GetTimeFormat(0, 0, &st, "HH.mm.ss" , acttime, 9);acttime[8]=0; strcpy(to->startdate,actdate); strcpy(to->starttime,acttime); strcpy(to->version,"0"); strcpy(to->patient,from->patient); strcpy(to->recording,from->device); sprintf(to->records,"%d",from->segments); sprintf(to->duration,"%d",1); sprintf(to->channels,"%d",from->channels); sprintf(to->headerlength,"%d",len); ch=(char *)to; for(t=0;t<256;t++,ch++) if (*ch==0) *ch=' '; to->end=0;}
开发者ID:Smeetal,项目名称:BrainBay,代码行数:33,
示例8: CallContextDayNote BOOL CallContextDayNote(SYSTEMTIME Time, HWND hCalendar) { CStringArray arr; arr.Add(_l("New reminder")); arr.Add(_l("Add date to clipboard")); int iSelection=SelectFromMenu(arr,0); if(iSelection<0){ return 0; } if(iSelection==0){ return -1; } CString s=""; COleDateTime tm;//=COleDateTime(Time); tm.SetDate(Time.wYear,Time.wMonth,Time.wDay); if(strlen(szDateFormat)==0){ s=DateFormat(tm,FALSE); }else{ SYSTEMTIME EventTime; tm.GetAsSystemTime(EventTime); char szTmp[1020]={0}; GetDateFormat(LOCALE_USER_DEFAULT,0,&EventTime,szDateFormat,szTmp,sizeof(szTmp)); s=szTmp; } BOOL bThroughGlobal=0; USES_CONVERSION; SetClipboardText(A2W(s),bThroughGlobal,0); return 0; };
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:29,
示例9: GetTime//////////////////////////////////////////////////////////////////////// Methode : GetTime// Resume : Return Time cache entry// In : FILETIME ft : the cache entry// Out : CString Time of the cache entry //////////////////////////////////////////////////////////////////////CString GetTime(FILETIME ft){ SYSTEMTIME st; char szLocalDate[255]; char szLocalTime[255]; CString strtemp; FileTimeToLocalFileTime( &ft, &ft ); FileTimeToSystemTime( &ft, &st ); GetDateFormat( LOCALE_USER_DEFAULT, DATE_SHORTDATE, &st, NULL, szLocalDate, 255 ); GetTimeFormat( LOCALE_USER_DEFAULT, 0, &st, NULL, szLocalTime, 255 ); strtemp = szLocalDate; strtemp += " | "; strtemp += szLocalTime ; return (strtemp);}
开发者ID:pierrecoll,项目名称:urlcache,代码行数:37,
示例10: os_ctimeW_r/** /brief Translate calendar time into readable string representation * * Possible Results: * - returns buf if buf != NULL * - returns NULL if buf == NULL */os_size_tos_ctimeW_r( os_timeW *t, char *buf, os_size_t bufsz){ os_size_t result = 0; SYSTEMTIME systemTime; FILETIME systemTimeSince1601; DWORD64 dw64Time; DWORD64 dw64MAXDWORD = MAXDWORD; wchar_t format[32]; char *fstr; /* Using win32 ctime here */ if (buf) { int iSizeOfBuffer; dw64Time = (t->wt)/100; systemTimeSince1601.dwHighDateTime = (dw64Time / (dw64MAXDWORD+1)); systemTimeSince1601.dwLowDateTime = (dw64Time % (dw64MAXDWORD+1)); FileTimeToSystemTime(&systemTimeSince1601, &systemTime); /* Time is in UTC here */ GetDateFormat(LOCALE_SYSTEM_DEFAULT, 0, &systemTime, L"yyyy'-'MM'-'dd'T'HH':'mm':'ss", format, 32); /* convert wide str to multi byte str */ fstr = wce_wctomb(format); result = snprintf(buf, bufsz, "%s", fstr); os_free(fstr); } return result;}
开发者ID:osrf,项目名称:opensplice,代码行数:41,
示例11: GetDateFormat//**************************************************************************************************b8 A2Date::ToStr(s8 *str){ if (!*(s32*)&date) return 0;#ifdef _WIN32 SYSTEMTIME time; time.wYear = date.y; time.wMonth = date.m; time.wDayOfWeek = 0; time.wDay = date.d; time.wHour = 0; time.wMinute = 0; time.wSecond = 0; time.wMilliseconds = 0; GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, str, -1);#else// sprintf(str, "%i.%i.%i", date.y, date.m, date.d);// sprintf(str, "%i.%i.%i", date.d, date.m, date.y % 100); sprintf(str, "%i/%i/%i", date.m, date.d, date.y % 100);#endif return 1;}
开发者ID:shysaur,项目名称:ChiptuneMDImporter,代码行数:26,
示例12: data_get_modified_string |