Date format in Talend "2006-05-27 17:00:00.000" - date

I am facing an issue with Talend dates. I have tried several solutions but still an "unparseable date" error persists.
My date format is of the form : "2006-05-27 17:00:00.000"
Can you help me ?

you can use below talendDate function to parse your string into date..
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss.sss","2006-05-27 17:00:00.000")
this would take input as string and return you date.

If you don't handle the conversion yourself in a tMap but just want to use a schema, then: In your mapping configuration in the date field, you can add the following string:
yyyy-MM-dd HH:mm:ss.SSS
to set the correct format mapping for the date string. Otherwise the answer of garpitmzn is the way to go.

you should use this function in talend to fetch date:
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss.SSS","2016-01-12 12:45:00.000")

Related

Matlab - isbusday and busdate format change

Would you be able to advise how can i change the format of the date the functions isbusday and busdate are using ?
The functions use US date format by default, but I need them to be in European format dd/mm/yyyy.
I have attempted to use the code below but it is not working.
isbusday('01-01-2015','dd-mm-yyyy')
busdate('01-01-2015','dd-mm-yyyy',1)
Thank you very much.
You want to convert your string to a datetime object. That is where you can control the format:
d = datetime('01-01-2015','InputFormat','dd-mm-yyyy');
isbusday(d)
busdate(t)
See the documentation: https://www.mathworks.com/help/matlab/ref/datetime.html and https://www.mathworks.com/help/finance/isbusday.html

Get a DateTime with an specific pattern with nscala-time

I am trying to get this pattern 'dd-MM-yyyy' with a variable of type DateTime
#{DateTimeFormat.forPattern("dd-MM-YYYY").parseDateTime(user.birthday.toString)}
But I am getting this error
java.lang.IllegalArgumentException: Invalid format: "2015-12-10T00:00:00.000Z" is malformed at "15-12-10T00:00:00.000Z"
Is there a way to do this with nscala-time?
makes a difference if I am using UTC?
UPDATE
For the moment I am casting to Date and doing this
#{Dates.format(user.birthday.toDate, "dd-MM-YYYY")}
But maybe is a better way without casting
thank you
So, if I understood your question correctly, you are trying to achieve the following:
Parse date from a string using a date format
Print/Display the date in another format.
Try the below:
#{Dates.format(DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ").parseDateTime(user.birthday.toString), "dd-MM-YYYY")}

Talend parse date: unable to parse

I'm trying to insert data in my Database, my input is a string, representing a date in this format: yyyyMMdd ("20140525")
I try this in talend :
TalendDate.parseDate("yyyyMMdd",row1.date_pre_contrat)
but at runtime it does not work...
I've also tried
TalendDate.parseDate("yyyy-MM-dd",row1.date_pre_contrat)
but the result is the same.
Does someone have a any clue on what the problem is?
Solution found:
it was because i didn't tell Talend not to analyse the first line which contains the title.
Sorry for this

Mongodb iso datetime

I need to recover date from mongodb iso date formate by angular js. How can I recover this? please help me.
Mongodb iso date: 2013-12-28T08:30:17.795Z
My convert type: 28-12-2013 8:30:17
Maybe something like:
var date = new Date("2013-12-28T08:30:17.795Z");
$scope.displayDate = date.toLocaleString();
I really recommend http://momentjs.com/. they have a good format function.
Ex.
moment('2013-12-28T08:30:17.795Z').format('DD-MM-YYYY HH:mm:ss');
Will give the answer
28-12-2013 08:30:17
Its very easy to get the time as per mongo,
get the value in your controller from the mongoDB.
Use that value to store in the variable.
Convert it to the ISO format easily using .toISOString() method and its done.
Here is sample..
getdate.controller(..){
$scope.fromdate=date.toISOString();
console.log($scope.fromdate);
}
Now you can get in the MongoDB format..

converting a utc format date string to date object in Extjs

I have a date string in the format "2013-01-31T10:10:05.000Z". I want to convert this string to a Date object in extjs.
I have tried to use Ext.Date.parse("2013-01-31T10:10:05.000Z","Y-m-dTH:i:s.uZ"). But it is returning undefined.
I also tried with new Date("2013-01-31T10:10:05.000Z"), but it is also returning undefined.
Note: I have tried in IE8 browser.
Could anyone please help me to convert the above date string to Date object?
Thanks a lot sra. Now I am getting the result as ...UTC+5:30... Is there any way to convert this in IST format?
Try Ext.Date.parse("2013-01-31T10:10:05.000Z","c");
The c is the format type for ISO 8601 formatted dates
See the Ext.Date API for more details on this or other available formats
That's because 'T' and 'Z' are special characters in the Date format: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.Date
You have to escape them like this: Ext.Date.parse("2013-01-31T10:10:05.000Z","Y-m-d\\TH:i:s.u\\Z")