[Qt-interest] New Date and Time Features in Qt5?
Ed Sutton
ESutton at fescorp.com
Fri May 13 22:04:41 CEST 2011
I would like to see something similar to .NET's TimeSpan class and DateTime::Subtract method.
http://msdn.microsoft.com/en-us/library/system.datetime.subtract.aspx
using System;
class Program
{
static void Main()
{
// Initialize a date in the past.
// This is March 3, 2008.
string someDate = "03-03-2008";
// 1.
// Parse the date and put in DateTime object.
DateTime startDate = DateTime.Parse(someDate);
// 2.
// Get the current DateTime.
DateTime now = DateTime.Now;
// 3.
// Get the TimeSpan of the difference.
TimeSpan elapsed = now.Subtract(startDate);
// 4.
// Get number of days ago.
double daysAgo = elapsed.TotalDays;
Console.WriteLine("{0} was {1} days ago",
someDate,
daysAgo.ToString("0"));
}
}
Thanks,
-Ed
On May 13, 2011, at 9:00 AM, John Layt wrote:
Hi,
I work on KDE doing localization code including the date/time functions. With
OpenGov and Qt5 coming up we are looking to see if we can get some new
features we want included in Qt's date and time handling.
As part of that I would like to know what other Qt users are missing and would
like to see supported. The wider the community interest in adding new
features the more likely they are to get them in.
The general sort of areas we are looking at include:
* More formatting options
* More date maths
* Proper timezone support
* Alternative calendar systems (Hebrew, Islamic, etc)
Just remember that Qt5 is trying to be mostly source compatible with Qt4 so
radical overhauls will not be possible, but extending the existing api is an
achievable goal.
Cheers!
John.
P.S. If your wanted feature already has a bug number please include it.
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com<mailto:Qt-interest at qt.nokia.com>
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
-Ed
More information about the Qt-interest-old
mailing list