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

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 329
Registered: ‎12-17-2010
My Device: Not Specified
My Carrier: developer
Accepted Solution

time in 24 hour format

 

Date date = new Date();
SimpleDateFormat sdFormat2 = new SimpleDateFormat("hh:mm");					DateField dateField2 = new DateField("TIME Mode", date						.getTime(), sdFormat2);

 

here i am getting time 12Hours Format but i want in 24 hours Format please help me how to get that

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: time in 24 hour format

From the Java doc -

 

SimpleDateFormat sdFormat2 = new SimpleDateFormat("HH:mm");

Developer
Posts: 329
Registered: ‎12-17-2010
My Device: Not Specified
My Carrier: developer

Re: time in 24 hour format

no peter again it is taking same 12 hours Format ....

 

i watched in java doc also ther also mentioned same but i dont what happening i am getting again 12 hours format value...

Date date = new Date();
SimpleDateFormat sdFormat2 = new SimpleDateFormat("HH:mm");
DateField dateField2 = new DateField("TIME Mode", date				.getTime(), sdFormat2);

 

 

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: time in 24 hour format

Looks like it uses system property in anycase. It just grab style (DATE, TIME or DATE_TIME) from formatter.

But I think it's correct. If user prefer to see 12h format why to force hime using the 24h format?

 

I'm also excited about current mess in DateField constructors from JavaDoc. They look pretty the same but some of them are depricated. Cool!

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: time in 24 hour format

Choose in device options to use 24h format and you will se it in DateField.
Developer
Posts: 329
Registered: ‎12-17-2010
My Device: Not Specified
My Carrier: developer

Re: time in 24 hour format

Sorry it is working fine due Debugger problem ....... 

 

Solution is 

 

Date date = new Date();
	SimpleDateFormat sdFormat2 = new SimpleDateFormat("HH:mm");
DateField dateField2 = new DateField("TIME Mode", date
							.getTime(), sdFormat2);

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: time in 24 hour format

And the difference between this and what I suggested is?

Developer
Posts: 105
Registered: ‎06-23-2010
My Device: 9000
My Carrier: vodaphone

Re: time in 24 hour format

:-)

-matt

Press Kudos if this helped - ;-)