本文整理汇总了C++中OGRFeature::GetFieldAsDateTime方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRFeature::GetFieldAsDateTime方法的具体用法?C++ OGRFeature::GetFieldAsDateTime怎么用?C++ OGRFeature::GetFieldAsDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRFeature
的用法示例。
在下文中一共展示了OGRFeature::GetFieldAsDateTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAsString
wxString wxGISFeatureDataset::GetAsString(int row, int col)
{
if(m_poLayer->GetFeatureCount() <= row)
return wxString();
else
{
OGRFeature* pFeature = GetAt(row);
OGRFieldDefn* pDef = pFeature->GetFieldDefnRef(col);
switch(pDef->GetType())
{
case OFTDate:
{
int year, mon, day, hour, min, sec, flag;
pFeature->GetFieldAsDateTime(col, &year, &mon, &day, &hour, &min, &sec, &flag);
wxDateTime dt(day, wxDateTime::Month(mon - 1), year, hour, min, sec);
return dt.Format(_("%d-%m-%Y"));//wxString::Format(_("%.2u-%.2u-%.4u"), day, mon, year );
}
case OFTTime:
{
int year, mon, day, hour, min, sec, flag;
pFeature->GetFieldAsDateTime(col, &year, &mon, &day, &hour, &min, &sec, &flag);
wxDateTime dt(day, wxDateTime::Month(mon - 1), year, hour, min, sec);
return dt.Format(_("%H:%M:%S"));//wxString::Format(_("%.2u:%.2u:%.2u"), hour, min, sec);
}
case OFTDateTime:
{
int year, mon, day, hour, min, sec, flag;
pFeature->GetFieldAsDateTime(col, &year, &mon, &day, &hour, &min, &sec, &flag);
wxDateTime dt(day, wxDateTime::Month(mon - 1), year, hour, min, sec);
return dt.Format(_("%d-%m-%Y %H:%M:%S"));//wxString::Format(_("%.2u-%.2u-%.4u %.2u:%.2u:%.2u"), day, mon, year, hour, min, sec);
}
case OFTReal:
return wxString::Format(_("%.6f"), pFeature->GetFieldAsDouble(col));
default:
return wgMB2WX(pFeature->GetFieldAsString(col));
}
//return wgMB2WX(GetAt(row)->GetFieldAsString(col));
}
}