Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
testinz
Posts: 176
Registered: ‎09-03-2012
My Device: Blackberry 10
Accepted Solution

QDateTime in qml?

Hello,

 

Just wondering how do you import and use the QDateTime object in qml?

 

Thanks!

Please use plain text.
Developer
ekke
Posts: 1,509
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: QDateTime in qml?

together with a DatePicker ?

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
Developer
lew
Posts: 174
Registered: ‎03-05-2009
My Device: Dev Alpha
My Carrier: -

Re: QDateTime in qml?

any reason you need QDateTime?

 

why not use the javascript date object?

var date = new Date();

var formattedDate = Qt.formatDateTime(date,"yyyyMMdd"); //to format date

 

you can't store a javascript date object in a 'propery variant' qml but you could simply import a javascript with a variable to persist this data within a QML context.

Please use plain text.
Developer
testinz
Posts: 176
Registered: ‎09-03-2012
My Device: Blackberry 10

Re: QDateTime in qml?

I was curious on how to import it. Javascript date object works, as well.

For anyone who need to use this in the future with DateTimePicker, you can use the Date.toISOString() function.
Please use plain text.