Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How to convert a String to a Date Value?(I have a string value (2015/004) that I want to convert to a date variable.)
How to convert a String to a Date Value? [message #1692284] Tue, 14 April 2015 18:14 Go to next message
Ken Strickland is currently offline Ken StricklandFriend
Messages: 14
Registered: April 2015
Junior Member
Here is my input data:

2015/103 2015 103 <=== EXTRACT_DATE EXTRACT_YEAR EXTRACT_DAY (All are string variables)
MCAPP02
MCAPP02
SGPRSML
DAS.BA7.GENNED.CBD.CNTL
0030 0180
55 55
2000/144 0000/000 2013/218 <======= DATES I WILL WANT TO COMPARE AGAINST; CREATE_DATE, EXPIRE_DATE, LASTUSE_DATE


DATA: EXTRACT_YEAR
Expression:
BirtStr.left(dataSetRow["DC_D::DCUDATE"],4)

Returns: 2015


DATA: EXTRACT_DAY
Expression:
BirtStr.right(dataSetRow["DC_D::DCUDATE"],3)

Returns: 103

Can I format the dates in an expression?

Is there a SimpleDateFormat for a yyyy/ddd value?

df = new Packages.java.text.SimpleDateFormat("yyyy-MM-dd");
myDate = df.parse(row["your_date_field_name"]);
myDate;

[Updated on: Wed, 15 April 2015 17:38]

Report message to a moderator

Re: How to convert a String to a Date Value? [message #1692446 is a reply to message #1692284] Wed, 15 April 2015 17:45 Go to previous messageGo to next message
Ken Strickland is currently offline Ken StricklandFriend
Messages: 14
Registered: April 2015
Junior Member
Got it using a DATA Expression:

df = new Packages.java.text.SimpleDateFormat("yyyy/ddd");
myDate = df.parse(row["DCU_DATE"]);
Re: How to convert a String to a Date Value? [message #1693289 is a reply to message #1692446] Wed, 22 April 2015 21:34 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Glad you were able to get it. Thanks for the update!

Michael

Developer Evangelist, Silanis
Re: How to convert a String to a Date Value? [message #1693345 is a reply to message #1693289] Thu, 23 April 2015 12:13 Go to previous messageGo to next message
kshirod mishra is currently offline kshirod mishraFriend
Messages: 50
Registered: March 2015
Member
Hi Williams,

I am trying to show zero value in the Y -Axis, while creating the dataset for my BIRT report, i am getting error like "Can not convert the value of to Double Type". I want to show the "ZERO" value in Y-Axis but my dataset is not allowing me to create the chart. Detail logs has been attached in the trail mail for more details. Please find the same and do the needful.


Thanks & Regards:
kshirod Mishra
  • Attachment: Eclipse.docx
    (Size: 199.07KB, Downloaded 160 times)
Re: How to convert a String to a Date Value? [message #1694661 is a reply to message #1693345] Thu, 07 May 2015 01:51 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Could you attach the design? It might be because of the string date. You might look at the x-axis type to make sure it's not an integer. Also, it looks like your B column is a string, so be sure you're not using that one in the y-axis.

Michael

Developer Evangelist, Silanis
Previous Topic:Urgent Capture and Insert values
Next Topic:page break not on first page
Goto Forum:
  


Current Time: Fri Apr 26 04:53:17 GMT 2024

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

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

Back to the top