Skip to main content



      Home
Home » Archived » BIRT » Date Functions
Date Functions [message #93807] Tue, 22 November 2005 08:53 Go to next message
Eclipse UserFriend
Originally posted by: andy.lawton.nospam.com

I want to add a number of milliseconds to a date/time field from my
database, and display the result.
After a bit of googling, I have put the following code in my field using the
expression editor:

var repdate =row["StartTimeAndDate"]
var enddate = repdate.getTime()
enddate += row["Time_Offset"]
repdate.setTime(enddate)

The format of row["StartTimeAndDate"] is "2005-11-22 12:30:00"
and row["Time_Offset"] is a number of milliseconds.

All I get on the report is "undefined".

What am I doing wrong?

Andy
Re: Date Functions [message #93824 is a reply to message #93807] Tue, 22 November 2005 09:10 Go to previous message
Eclipse UserFriend
Originally posted by: andy.lawton.nospam.com

An extra bit:

If I try and preview the report in the designer, I get a ....

There are errors on the report page:
- There are error(s) in Data : null
Error0 : data.engine.JSScriptInvalid ( 1 time(s) )detail : Invalid
Javascript expression. Source: null, line: 1, Expression:Script engine
error: TypeError: Cannot call method "getTime" of undefined

..... error. I just get Undefined when I view the report using TomCat.

Andy



"Andy" <andy.lawton@nospam.com> wrote in message
news:dlv868$rc1$1@news.eclipse.org...
>I want to add a number of milliseconds to a date/time field from my
>database, and display the result.
> After a bit of googling, I have put the following code in my field using
> the expression editor:
>
> var repdate =row["StartTimeAndDate"]
> var enddate = repdate.getTime()
> enddate += row["Time_Offset"]
> repdate.setTime(enddate)
>
> The format of row["StartTimeAndDate"] is "2005-11-22 12:30:00"
> and row["Time_Offset"] is a number of milliseconds.
>
> All I get on the report is "undefined".
>
> What am I doing wrong?
>
> Andy
>
>
>
Previous Topic:Rendering quality II
Next Topic:Grouped reports
Goto Forum:
  


Current Time: Sun May 11 15:48:10 EDT 2025

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

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

Back to the top