QML Date -- Storage and locale-based display

How would you recommend to store a date in a database? As milliseconds? In a QML application, I can easily get this by the Date.now() function. However, if the date is stored as milliseconds, how could I go about displaying the date, using some of the functions of the Date QML type? This seems to be shrouded by mystery to me at this minute. I would prefer the date to be printed locale-sensitively, so that different users in different countries get the culture-specific formatting.


Ok, it was pretty simple. I guess it is ok to store the date as milliseconds, as you can simply create a new Date object from that in QML. The locale formatting functions have couple of easy variants for printing both date and time separately:

Text {
    property var dateOf: new Date(myTimeInMilliseconds)
    text: dateOf.toLocaleDateString() + "  " + dateOf.toLocaleTimeString()

Need Your Help

C# MVC - Creating dynamic charts using datetimepickers

javascript c# asp.net asp.net-mvc charts

I'm attempting to create a charting module in my site where clients can view their data. I originally created some pre-set charts (Annual, Monthly) to represent different aspects of my data, but no...

Link_to in Ruby on Rails

html ruby-on-rails ruby erb link-to

I have a from where I need to return a search result in a table and when the user clicks on the required result, it takes him to another page. The problem is when I add the link_to method to the ta...