#1 2012-04-18 09:59:26

Joe
Member
Registered: 2011-01-07
Posts: 102

date format

Tags: [date, datepattern]

Hi all

a test job as follow

tMSSqlInput—main—>tJavaRow

there are two datetime columns,whose date pattern are both 'yyyy-MM-dd HH:mm:ss.SSS'.

in tJavaRow:
print these two datetime columns.

Result :
Wed Dec 12 13:37:07 PST 2007
Tue Nov 27 20:03:30 PST 2007

It's not what i want.
I need a result with a format as 'yyyy-MM-dd HH:mm:ss.SSS'.

Is there anything wrong with my job?


BestRegards,
Joe

Offline

#2 2012-04-18 10:12:16

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: date format

Hi Joe

I have tested it and get correct results as the following images.

Check date pattern for each Date column.

Regards,
Pedro


Uploaded Images


Only Paranoid Survive.

Offline

#3 2012-04-18 10:43:38

Joe
Member
Registered: 2011-01-07
Posts: 102

Re: date format

Hi pedro

Thanks for your reply.But that's not what i want.

I want to output the result from tJavaRow.

In fact ,I write a function for datediff ,having a precision of day. Be different from java datediff, I need to keep the date and ignore the time.

My function:
    public static long dateDiff(Date issueDate,Date originalInvoiceDate){
          
            if (issueDate == null) {
                issueDate = new Date(0);
            }
            if (originalInvoiceDate == null) {
                originalInvoiceDate = new Date(0);
            }
                long day1 = issueDate.getTime()/1000/60/60/24;
                long day2 = originalInvoiceDate.getTime()/1000/60/60/24;
                long day = (day1-day2);
                return day;
    }
It always return a result with one day differnt from the result given by MS SQL datediff


Joe

Offline

Board footer

Powered by FluxBB