DATEDIFF function
-
Hi Is exists in c++ a function similar to DATEDIFF in SQL or VB THANK
-
Hi Is exists in c++ a function similar to DATEDIFF in SQL or VB THANK
If you're using MFC, have a look at
CTimeSpan
class http://msdn2.microsoft.com/en-us/library/ay6ws8h3(VS.80).aspx[^]. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
-
Hi Is exists in c++ a function similar to DATEDIFF in SQL or VB THANK
-
Hi Is exists in c++ a function similar to DATEDIFF in SQL or VB THANK
Unfortunately, none of the two suggestion above will do what DATEDIFF does... You need to separate the DATE part of your time value. You didn't say what data type you use for your date/time variables. The easiest way, I think, is to convert both dates to COleDateTime (which wraps double representation of date/time), truncate the fractional part and simply subtract one value from another.
----------------------------- Get trial copy of FeinViewer - an integrated GDI objects viewer for Microsoft Visual Studio .NET 2005 (8.0) Visual C++ Debugger, and other convenience and productivity tools for Microsoft Visual Studio .NET at at www.FeinSoftware.com