Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How to set date format programmatically
How to set date format programmatically [message #541809] Tue, 22 June 2010 15:18 Go to next message
Reinhard  is currently offline Reinhard Friend
Messages: 31
Registered: July 2009
Member
Hello guys,

I create a report programmatically and have a date-time column. Data for this column comes in short format, like 22.06.10. 15:06:53 I have to set this column to date-time data type.

I do it this way: computedColumn.setDataType(DesignChoiceConstants.COLUMN_DATA _TYPE_DATETIME);

Now I get a following output: 22.06.0010 15:06:53. The year has 4 digits and first two are 00.

The question is, how can I set the DateTime format. I found a constant for this, DesignChoiceConstants.DATETIEM_FORMAT_TYPE_SHORT_DATE but how to set it ant to which component.

Thanks in advance.
Reinhard
Re: How to set date format programmatically [message #541844 is a reply to message #541809] Tue, 22 June 2010 17:08 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Reinhard,

We should have a StructureFactory implementation for this. Can you
open a bug for it? You can do what you want using this code:

FormatValue formatValueToSet = new DateTimeFormatValue( );
formatValueToSet.setPattern( "dd/mm/yy" );
formatValueToSet.setCategory("Custom");
data.setProperty( StyleHandle.DATE_TIME_FORMAT_PROP,
formatValueToSet );

You can also call data.getStyle().setDateTimeFormat if a style exist for
the data item.

Jason

On 6/22/2010 11:18 AM, Reinhard wrote:
> Hello guys,
>
> I create a report programmatically and have a date-time column. Data for
> this column comes in short format, like 22.06.10. 15:06:53 I have to set
> this column to date-time data type.
> I do it this way:
> computedColumn.setDataType(DesignChoiceConstants.COLUMN_DATA
> _TYPE_DATETIME);
>
> Now I get a following output: 22.06.0010 15:06:53. The year has 4 digits
> and first two are 00.
>
> The question is, how can I set the DateTime format. I found a constant
> for this, DesignChoiceConstants.DATETIEM_FORMAT_TYPE_SHORT_DATE but how
> to set it ant to which component.
>
> Thanks in advance.
> Reinhard
Previous Topic:Chinese characters in the runtime engine ?
Next Topic:Chart id in Event Handler
Goto Forum:
  


Current Time: Fri Apr 26 23:34:36 GMT 2024

Powered by FUDForum. Page generated in 0.03059 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top