Unparseable Date error - Talend - date

I am trying to copy data from Excel to a SQL table.
I have dates generated in Excel file using RAND function. I am taking them as strings in an input and trying to convert them in date data type using tConvertType.
I have setted its datatype as 'string' in initial input and as 'date' in tConvertType's output and in tMSSqlOutput.
My job has work flow Excel input -> tConvertType -> tMap -> tMSSqlOutput.
While running the job I am getting an error which says :
java.text.ParseException: Unparseable date: "Tue Jul 17 00:00:00 EDT 1973"
I am not sure where the problem lies.
If anyone could help me with this it would be much appreciated.
Here's the screenshot of my job.

i am able to parse your given sample date please use below function in tMap for your date filed.
System.out.println(TalendDate.parseDateLocale("EEE MMM dd HH:mm:ss zzz yyyy", 'Tue Jul 17 00:00:00 EDT 1973', "EN"));
function is yourDateColumn!=null && !"".equalsIgnoreCase(yourDateColumn)? TalendDate.parseDateLocale("EEE MMM dd HH:mm:ss zzz yyyy", yourDateColumn, "EN") :null

#UmeshR: your code is working fine, but you have to handle the timezone thing as well. e.g. I am from India and when i converted the time from EDT talend converted it to my local timezone. see the screen-shot.

Related

Convert Dates in Powershell but Format Not Recognized

I'm trying to use powershell to convert a string that contains RFC 2822 formatted dates into another format. Right now I'm getting an error saying my string was not recognized as a valid DateTime.
Write-Host ([Datetime]::ParseExact('Thu Oct 07 09:23:26 UTC 2021', '[R][1]', $null)).ToString("yyyyMMdd")
I'm not sure what I'm doing wrong.
The R standard datetime format string specifier does not describe the format you've supplied.
You're gonna need a custom format string:
[Datetime]::ParseExact('Thu Oct 07 09:23:26 UTC 2021', 'ddd MMM dd HH:mm:ss UTC yyyy', $null)

Convert uncommon String date/time data to DateTime data type

I'm trying to implement a PowerShell script to compare DateTime from certificate file(Jave Keystore).
However, the DateTime format that I extract from keystore file is quite complex as example below.
Mon Mar 13 06:40:26 CDT 2023
Sat Sep 18 20:41:47 CDT 2027
It includes time and timezone in the String but I actually need only date like 13-Mar-2023.
Could anyone help suggest how I return this String to be DateTime for comparison?
Thanks a lot.
You can use the [datetime]::ParseExact() method for this:
$dateString = 'Mon Mar 13 06:40:26 CDT 2023'
$date = [datetime]::ParseExact($dateString, 'ddd MMM dd HH:mm:ss CDT yyyy', [cultureinfo]'en-US')
$date.ToString('dd-MMM-yyyy')
Result:
13-Mar-2023
CDT means Central Time Zone (UTC - 6), switched to DayLight Saving Time --> Central Daylight Time (CDT) which is five hours behind UTC

`Thur, Aug 23` Date format with flutter

According to the documentation, it seems that it is only possible to manipulate dates with a numeric format, and not letters.
Does a package exist if I want to display date with the format Thur, Aug 23 ?
If not, how could I do this ?
Thank you !
You can create your own DateFormat using it's default constructor.
The format you want is EEEE, MMM d.
For Example print(new DateFormat("EEEE, MMM d").format(new DateTime.now())); should print Wedn, Jun 26 for today.

I am getting T in my date string from web service

I am creating an app which is using RSS feed.
in that I have to parse a dateTime string.
string coming in data is : Tue, 17 Sep 2013T04:00:00 GMT
I can not convert it into date because of that T b/w year and hour.
Can anyone please provide me the date format for this?
I am using formate like EEE, dd MMM yyyy HH:mm:ss ZZZ
But it is giving null value
I used : EEE, dd MMM yyyy'T'HH:mm:ss ZZZ
and it worked..

Groovy date parse issue

date.parse() method of groovy detects date DD and year yyyy correctly but is unable to detect the month as mmm.. As in
println new Date().parse("DD-MMM-yyyy", '22-MAR-2011')
yields output as
Sat Jan 22 00:00:00 GMT+05:30 2011
Why is the month march as MAR picked up as Jan? What can I do to make it detect the month in mmm format?
The problem is actualy that you are using DD - that means day in year
Correct way:
println new Date().parse("dd-MMM-yyyy", '22-MAR-2011')
Quick tip when formatting dates try using the reverse and see what comes out:
println new Date().format("dd-MMM-yyyy")
Groovy uses SimpleDateFormat under the hood but that's not that important since most date libraries use the same format conventions.