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; }