E.Rudi
April 15th, 1999, 07:38 AM
A Problem with COleDateTime:
The YEAR-FORMAT with COleDateTime is only yy when
year is <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->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;
.
.
.
...
//-----------------------------------------------------------------------------
The YEAR-FORMAT with COleDateTime is only yy when
year is <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->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;
.
.
.
...
//-----------------------------------------------------------------------------