Notices


Reply
Thread Tools
Posts: 85 | Thanked: 382 times | Joined on Jan 2010 @ Hong Kong
#1
How many days from now until December 21st 2012? How old am I in number of days? If I stop eating now for World Vision 30 Hour Famine, when shall I be able to start eating again?

Time Calculator (TimeCalc) is a little handy tool to answer all these types of questions! You can add/subtract a number of years, months, days, hours, minutes, or seconds to/from a date/time value. You can also find out the difference between two date/time values.

Key Features
  • Add / subtract a number of years, months, days, hours, minutes, or seconds to / from a date / time value.
  • Find out the difference between two date/time values.


  • Support decimal and negative values, and Simplified / Traditional Chinese localisation.

Video Demo
http://www.youtube.com/watch?v=BAKYlfSDJvA (English, demo with N950)
http://www.youtube.com/watch?v=2tBuNLCROeo (Cantonese, demo with N9)
Assumptions

According to the definition of the Gregorian calendar, the following assumptions are made in this application:
  • 1 Year = 365.25 days
  • 1 Month = 30.436875 days
  • 1 Week = 7 days
  • 1 Day = 24 hours
  • 1 Business Day = A day in between Monday and Friday inclusive, except local public holidays.
  • (Future support of customising local public holidays may be added.)
  • 1 Hour = 60 Minutes
  • 1 Minute = 60 Seconds
  • Earliest date supported: 4713/01/02 B.C. (i.e. the next day of the Julian Day)
  • Earliest Selectable Date: 1900/01/01 00:00:00
  • Latest Selectable Date: 2099/12/31 23:59:59
  • Largest Plus / Minus Value: 99999
  • A.D. 2012 - 2012 years = 1 B.C., as there is no Year 0 by definition
Notice

Calculation results of this application are for reference purpose only; their accuracy is not guaranteed.
Download

You can now download the stable version of this app from the Nokia Store at your N9 by searching the keyword TimeCalc.
Source Code
I have created a project at Nokia Developer Projects site where you can find the source code of this app:

https://projects.developer.nokia.com/timecalc
Developer's Sidenote

This app is entirely developed in QML and JavaScript. Here are some findings while I was developing this app, which might be useful to you if you're messing up with similar controls / constraints:
  • The date and time selection dialogs (DatePickerDialog and TimePickerDialog) are extra components provided by Qt Quick 1.1 for Symbian and MeeGo 1.2 Harmattan. To use these components, you need the following declarations:

    Code:
    import QtQuick 1.1
    import com.nokia.meego 1.0
    import com.nokia.extras 1.0
    The maximumYear and miniYear attributes define the selection scope of the year. The default value of maximumYear attribute is current year + 20 years, and the default value of the minimumYear attribute is the current year. If you specify a very large scope, say minimumYear = 0 and maximumYear = 2999, it will take quite a bit of time to load the component and hence the year. To take a balance in between performance and practicality (I guess this is still adequate enough for some years in the future? Assuming the Judgment Day will not come too soon... ), the earliest selectable year of this app is defined as 1900 and the latest selectable year is defined as 2099.
  • Most date and time calculations make use of the native date and time functions provided by the QML JavaScript engine. The weird thing is, only the QML JavaScript engine has a lowest day limit, which is the next day of Julian Day (why Julian Day, and why the next day of it?!). The WebKit2 / JavaScript engine of the N9's native browser, as well as all the major desktop browsers (IE, Firefox, Chrome, Safari and Opera), all don't have such limit.
  • When QML JavaScript engine handles 2-digit years, it will be treated as 19XX. For example, year "12" will be treated as "1912". Even when you specify x = new Date(2012-2000,1,1,0,0,0,0), the value of x you get get will be 1912/1/1. However, most desktop major browsers would also be using this kind of assumption (smells like Y2K-related issues?). In this app, I have to handle these cases specifically.
  • I have made use of the localisation features provided by Qt and Qt Linguist to create UI localisations for English, Traditional Chinese and Simplified Chinese. However, the menu items in the SelectionDialog component cannot be localised directly using qsTr() or QT_TR_NOOP(). You will have to prepare a JavaScript function that creates the menu items for the ListModel to be used by the SelectionDialog component, and then call this JavaScript function during the Component.onCompleted event of the Page (i.e. when the app starts).
  • The logic of the business day (i.e. Mon-Fri) plus/minus and time difference calculations cannot be done directly by the native JavaScript date/time functions. This needs to be handled by the developer separately.

Feel free to submit localisations, patches and enhancements!

Last edited by amandalam; 2012-03-04 at 17:26.
 

The Following User Says Thank You to amandalam For This Useful Post:
www.rzr.online.fr's Avatar
Posts: 1,323 | Thanked: 1,777 times | Joined on Jan 2009 @ fr/35/rennes
#2
nice can it also support maemo5 ?
__________________
Please help to list all maemo existing apps :

https://wiki.maemo.org/Apps#

I am looking for " 4 inch TFT LCD display screen " for Nokia n950 HandSet

http://rzr.online.fr/q/lcd


Also, I need online storage to archive files :

http://db.tt/gn5Qffd6#

https://hubic.com/home/new/#NWEDND#

https://my.pcloud.com/#page=register...e=g8ikZmcfEJy#

Upcoming contest:

https://wiki.tizen.org/wiki/Store
 
Posts: 85 | Thanked: 382 times | Joined on Jan 2010 @ Hong Kong
#3
Originally Posted by www.rzr.online.fr View Post
nice can it also support maemo5 ?
No (not yet).
 
Posts: 479 | Thanked: 538 times | Joined on Jul 2012 @ Mexico
#4
@amandalam
can you upload it to openrepos.net ?

Thanks
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 03:27.