本文整理汇总了C++中Date::EDate方法的典型用法代码示例。如果您正苦于以下问题:C++ Date::EDate方法的具体用法?C++ Date::EDate怎么用?C++ Date::EDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::EDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (void)
{
Date ad;
Date bd;
Date cd;
printf("ad is (%s)\n", ad.GetValue()());
printf("ad is also (%s)\n", ad.GetValue("%Y-%m-%d-%H-%M-%S")());
bd.SetValue("07/13/2001 01:02:03.456", "%m/%d/%Y %H:%M:%S");
printf("bd is (%s)\n", bd.GetValue()());
printf("bd is also (%s)\n", bd.GetValue("%m/%d/%Y %H:%M:%S")());
printf("bd is also (%s)\n", bd.GetValue("%Y%m%d%H%M%S")());
printf("bd is also (%s)\n", bd.EDate()());
printf("bd is also (%s)\n", bd.EDate()());
printf("bd is also (%s)\n", bd.EDate()());
printf("bd is also (%s)\n", bd.EDate()());
twine tmp, tmp2;
tmp2 = bd.EDate();
tmp.format("Date: %s\r\n", tmp2() );
printf("%s\n", tmp());
printf("Before direct format\n");
tmp.format("Date: %s\r\n", bd.GetValue("%Y%m%d%H%M%S")() );
printf("After direct format\n");
printf("%s", tmp() );
printf("Before EDate format\n");
tmp.format("Date: %s\r\n", bd.EDate()() );
printf("After EDate format\n");
printf("%s", tmp() );
ad.Floor();
bd = ad;
bd.Ceil();
printf("ad is (%s) bd is (%s)\n", ad.GetValue()(), bd.GetValue()());
cd.SetValue("7/4/2001", "%m/%d/%Y");
printf("cd is (%s)\n", cd.GetValue()());
cd.SetValue("7/4/89", "%m/%d/%Y");
printf("cd is (%s)\n", cd.GetValue()());
cd.SetValue("7/4/01", "%m/%d/%Y");
printf("cd is (%s)\n", cd.GetValue()());
cd.SetValue("20010714080910.123", "%Y%m%d%H%M%S");
printf("cd is (%s)\n", cd.GetValue()());
cd.SetValue("2001/09/01 00:08:05");
printf("Initial cd is (%s)\n", cd.GetValue()());
cd.AddSec(-65);
printf("cd is (%s)\n", cd.GetValue()());
ad.SetValue("2001/08/09 12:00:00");
bd.SetValue("2001/08/09 12:30:00");
if(bd - ad > SLib::Interval(10, MINUTES)){
printf("(%s) - (%s) has a difference greater than 10 minutes\n",
bd.GetValue()(), ad.GetValue()());
}
if(bd - ad > SLib::Interval(20, MINUTES)){
printf("(%s) - (%s) has a difference greater than 20 minutes\n",
bd.GetValue()(), ad.GetValue()());
}
if(bd - ad > SLib::Interval(1, DAY)){
printf("(%s) - (%s) has a difference greater than 1 day\n",
bd.GetValue()(), ad.GetValue()());
}
test_conversions();
return 0;
}