CComDATE



  • Goil, so klappts! Merci!



  • Hab leider noch was.

    Wie müsste dieser Code abgeändert werden, damit das klappt?

    #include <iostream> 
    #include <atlbase.h> 
    
    #include "comdate.h" 
    
    using namespace std; 
    
    int main() 
    { 
        CComDATE zeit = CComDATE::Now(); 
        string ausgabe; 
    	ausgabe = "Aktueller Tag im Monat: ";
    	ausgabe += zeit.Day(); 
    
        cout<<ausgabe<<endl; 
    
        return 0; 
    }
    

    Donge ...





  • IUTFSFBAYMKISNTETFWOISFO!

    means:

    I used the search-function, but as you might know, it is not that easy to find what one is searching for, ok?



  • YKTFHJAFPSYMJBATSTWTSF

    You know, the FAQs have just a few pages, so you might just be able to search them without the search function. 😉



  • OOYAMR

    Ok, ok, you are maybe right ... 😉



  • Hatte keinen Bock ein neues Thema zu eröffnen, es geht nämlich wieder um die Klasse CComDate: Bekannterweise (?) gibt es ja da die Methode CComDate::Format (oder auch CComDate::DateFormat und CComDate::TimeFormat), die das vom Benutzer definierte Datum und die Zeit zurückgeben.
    Nun verstehe ich nicht ganz, welche Werte ich der Methode übergeben muss. Auch aus dem Quellcode der Methode werde ich nicht sonderlich schlau!

    Falls das jemandem hilft:

    inline
    LPTSTR CComDATE::Format(LPTSTR pszOut, LPCTSTR pFormat) const
    {
        *pszOut = 0;
    
        // If invalild, return empty string
        struct tm tmDest;
        if (!IsValid() || !Maketm(&tmDest, m_date) ) return pszOut;
    
        // Fill in the buffer, disregard return value as it's not necessary
        // NOTE: 4096 is an arbitrary value picked lower than INT_MAX
        // as the VC6 implementation of wcsftime allocates memory based
        // on the 2nd parameter for some reason.
        _tcsftime(pszOut, 4096, pFormat, &tmDest);
        return pszOut;
    }
    


  • Wenn du in der MSDN Library nach _tcsftime suchst, findest du das.



  • Danke, aber das hab ich auch schon gefunden, werde aber trotzdem nicht schlau draus. Wahrscheinlich ist es noch zu früh am morgen ... *gääääähhn*



  • Der Formatstring bei strftime ist ähnlich aufgebaut wie bei sprintf & Co.

    CComDATE zeit = CComDATE::Now();
    TCHAR datum[100];
    zeit.Format(datum, _T("Heute ist der %d.%m. des Jahres %Y."));
    

Anmelden zum Antworten