converting a utc format date string to date object in Extjs - date

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")

Related

DataStage Parsing Input String to Date Format

I have a string input format of i.e
'Thu, 30 Nov, 2017'
I need to transform this into a more Oracle database friendly Date type format of something like '11-30-2017' or '11/30/2017'. I started in the path of
Convert(' ','-',Convert(',','',DSLink.InputDate[5]))
which should return a string of: 30-Nov-2017
However I'm stuck on dynamically parsing the 'Nov' month part. Any clever ideas?
also I don't think this will work:
StringToDate(Convert(' ','-',Convert(',','',DSLink.InputDate[5])),"%dd-‌​%mm-%yyyy")
as the function is looking for a numeric type on the month field?

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

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")

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")}

Parsing String to Date during internationalization in gwt

i am try to parse string to date it works normally well but when i am use internationalization with &locate=fr then it will thrown java.lang.IllegalArgumentException.
hear is the peace of code i want to get date from string.
public static Date toDate(String date){
DateTimeFormat format = DateTimeFormat.getFormat("MM/dd/yy h:mm:s a");
return format.parseStrict(date);
}
and i am try to convert "02/02/2012 10:10:25 AM".
please help me.
Try using parse() instead of parseStrict(). If you use parse() dates are parsed leniently, so invalid dates will be wrapped around as needed. And with parseStrict() dates are parsed strictly, so invalid dates will result in an IllegalArgumentException. See you are using different format for your date.
02/02/2012 which corresponds to MM/dd/yyyy not to MM/dd/yy
public Date parseStrict(java.lang.String text) throws java.lang.IllegalArgumentException
Parses text to produce a Date value. An IllegalArgumentException is
thrown if either the text is empty or if the parse does not consume
all characters of the text. Dates are parsed strictly, so invalid
dates will result in an IllegalArgumentException.
instead of standard DateTimeformat use com.google.gwt.i18n.client.DateTimeFormat

convert date to xml type date ('YYYY-MM-DD"T"HH24:MI:SS)

the user enters date in mm-dd-yy format. I have to convert this into ('YYYY-MM-DD"T"HH24:MI:SS) how can i do this in vb.net
Thanks
use DateTime Parse or ParseExact methods (or their Try... variation)
then ToString with your format string the resulting value if it is valid, otherwise tell user to enter a better value.
I don't actually speak VBian so I can't provide sample code.