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
Posts: 134
Registered: ‎08-03-2011
My Device: torch, Z10
My Carrier: Vodafone, Airtel

Getting wrong value in DateTimePicker

Hi,

I getting some problem in DateTimePicker.
The minute value is not changing in everyminute, it is changeing in 5 minute interval. and in place of seconds value always getting 00, it is not changing.

DateTimePicker {
id: picker1
mode: DateTimePickerMode.Date
}

picker1.value

 


e.g.
2013-11-15T10:10:00
2013-11-15T10:15:00

-----------------------------------------------------------------------
"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
-----------------------------------------------------------------------
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Getting wrong value in DateTimePicker

That's because you have only specified you are interested in the Date try using DateTime...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__datetimepickermode.html#enum...


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 134
Registered: ‎08-03-2011
My Device: torch, Z10
My Carrier: Vodafone, Airtel

Re: Getting wrong value in DateTimePicker

Same problem in

mode: DateTimePickerMode.DateTime
-----------------------------------------------------------------------
"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
-----------------------------------------------------------------------
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Getting wrong value in DateTimePicker

Is this an accuracy problem for you?

 

If you want a date and also a time accurate to the second you will need to do them as two seperate pickers or do your own custom one.

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 134
Registered: ‎08-03-2011
My Device: torch, Z10
My Carrier: Vodafone, Airtel

Re: Getting wrong value in DateTimePicker

I want to use only date piker without time. but need to get TimeStamp accurate value.

-----------------------------------------------------------------------
"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
-----------------------------------------------------------------------
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Getting wrong value in DateTimePicker

I'm not sure I really understand, the picker is there for the user to pick a date and time it is not linked to a real time in any way? Obviously you can initialise it to that date and time when first showing.

 

Can you explain your user case?

Does your user have control over the time or not?


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Getting wrong value in DateTimePicker

[ Edited ]

Obviously once you have the value you can manipulate it however you want, so you can replace the date and time with the current one at will using normal functions.

 

Take a look at this for an example of manipulating the value after you have it...

 

http://developer.blackberry.com/native/documentation/cascades/ui/pickers/datetimepicker.html#joh1360...

 

The value returned is a QDateTime which has lots of associated functions to manipulate the value...

 

http://harmattan-dev.nokia.com/docs/library/html/qt4/qdatetime.html


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Highlighted
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Getting wrong value in DateTimePicker

[ Edited ]

I'll have a guess that this is probably what you are trying to do...

 

DateTimePicker {
    id: pickerDate
    title: "Date"
    value: "1980-04-15"
	            
    onValueChanged: {
	var d = new Date();
	var f = pickerDate.value;
	f.setHours(d.getHours());
        f.setMinutes(d.getMinutes());
        f.setSeconds(d.getSeconds());
        console.log(f);
    }
}

 If not I'm sure you can see how to manipulate the date and/or time from this example.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.