I have a large dataset (close to 80,000) of tweets dated like this:
Wed Oct 05 01:20:53 +0000 2016
What script can I run to convert the dates in Google Sheets to the simple mm/dd/yyyy form?
In this case, it should be: 10/05/2016
Thanks!
If the format of the date is you mentioned is consistent, you can use the below formula (assuming the date is in cell A1)
=DATEVALUE(RIGHT(A1,4) & MID(A1,5,3) & MID(A1,9,2))
This will extract the Datevalue from the string and then you can format it to look in the mm/dd/yyyy format
Try
=arrayformula(if(A1:A="",,1*(regexextract(A1,"\d{2}")&"/"®exextract(A1,"\D+ (\D+) ")&"/"®exextract(A1,".* (\d+)"))))
or (with hours/minutes/seconds)
=arrayformula(if(A1:A="",,1*(regexextract(A1,"\d{2}")&"/"®exextract(A1,"\D+ (\D+) ")&"/"®exextract(A1,".* (\d+)"))+regexextract(A1,"\d{2}:\d{2}:\d{2}")))
and define the appropriate format
Another solution
=index(ifna(Text(1&RegexExtract(A:A,".*?\s(.*?)\s"),"MM")&"/"&RegexExtract(A:A,"\d{2}")&"/"&RegexExtract(A:A,".*\s(.*)")))
Or
=index(text(regexreplace(regexreplace(A:A,"\+0000\s",),"(.*)(\d+:\d+:\d+)\s(.*)","$1$3 $2"),"mm/dd/yyyy"))
Or
=index(text(regexreplace(A:A,"(.*\s)(\d+:.*)\+.*\s(.*)","$1$3 $2"),"mm/dd/yyyy"))
I'm using Date::i18nFormat to display dates using the desired locale.
This is an example: $post->date->i18nFormat("dd 'of' MMMM"). This Outputs: 19 of june.
I would like to capitalize the first letter of the month, so it would output instead: 19 of June.
is it possible?
Thank you
I have the two fields
November 14 2019 10:35:24 AM and November 14 2019 as string from file
I want to convert in datstage to these fields as
11/14/2019 10:35:24AM and 20191114 respectively
Please note: after month there is one space between November and 14 and two spaces between 14 and 2019
and in output 11/14/2019 and time there is two spaces
As the input is a string and it seems you want again a string as a result string manipulation functions in a Transformer stage are always an option.
Alternatively you could also try to use the String_to_Timestamp and STRING_TO_DATE function on the same page
You will find valid format options here
I'm having trouble converting a couple of sting fields to date with Talend Open Studio. All date fields are coming to me via csv in the format "MM/dd/yyyy hh:mm:ss aa" For example "03/20/2018 2:40:03 PM"
Many date fields are fine, and conversion with the t-map component and the talend.date (parse date) is working as it should. The problem occurs in two fields where many almost all of the dates are coming in as "12/30/1899 00:00:00 AM"
I'm using the tmap to push the file to a toutputdelimited (CSV). The format of the fields with "12/30/1899 00:00:00 AM" is coming back as "#######################." Any ideas on how to handle the situation would be great. The output date format is "yyyy-MM-dd HH:mm:ss"
Again, all other fields are converting as they should. Its only the special case "12/30/1899 00:00:00 AM" that is causing problems.
Thans!
Since your dates can be of different formats, you need to read your column as a String type in your tFileInputDelimited, then inside a tMap, check the date type (a simple way to check it is by testing its length) and parse it using the correct date format:
tFileInputDelimited -- tMap -- output
In a tMap expression, you can have something like this :
row.created_ts.length() == 22 ? TalendDate.parseDate("yyyy-MM-dd hh:mm:ssX", row.yourdate) : TalendDate.parseDate("yyyy-MM-dd hh:mm:ss.SSSSSSX", row.yourdate)
I need to get the act hour in Lua without the leading zeros(in 24 hour mode)
it's like date("G") in PHP
I actually have this code
os.date("%d-%m-%Y %H")
but it returns me 01 , 02 , 03 .... and I need to get 1 , 2, 3 etc
I found this but it doesn't seem to help me to solve my problem
os.date formats
You can just remove the leading zero:
os.date("%d-%m-%Y %H"):gsub(" 0"," ")
Try to get hour :
local hour = os.date("%H")
And try to format with string.format :
string.format("%d", hour)