CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    1

    YEAR-FORMAT with COleDateTime is only yy when year is <2000

    A Problem with COleDateTime:

    The YEAR-FORMAT with COleDateTime is only yy when
    year is &lt;2000, but i need the format yyyy

    For example: The Date is 14/4/99, but i need 14/4/1999.
    Is the Year 2000, it is 14/4/2000.

    Is the following COleDateTime Format-command okey?
    strRet = COleDateTime(var).Format(LOCALE_NOUSEROVERRIDE, LANG_USER_DEFAULT);

    My coding:

    CDaoRecordset rs(& pDoc-&gt;m_TaxDB);
    ...
    COleDateTime dateTime;
    CString str;
    COleVariant var;
    ...
    rs.Open(&qd, dbOpenSnapshot, dbReadOnly);
    ...
    str = GetStringfromVariant (rs.GetFieldValue(field));
    ...

    //-----------------------------------------------------------------------------
    CString CExampleView::GetStringfromVariant(const COleVariant& var)
    {
    strRet = _T("");
    COleVariant varT = var;

    switch(var.vt){
    case VT_DATE:
    strRet = COleDateTime(var).Format(LOCALE_NOUSEROVERRIDE, LANG_USER_DEFAULT);
    break;
    .
    .
    .
    ...
    //-----------------------------------------------------------------------------



  2. #2
    Join Date
    May 1999
    Posts
    34

    Re: YEAR-FORMAT with COleDateTime is only yy when year is <2000

    You probably know this, but I thought I should try. Look up Format in the MSDN.

    Good Luck,
    Marc


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured