How to convert string to date in Jekyll? - jekyll

I have a csv file where a column has date information in the following format- 07-17-2020. I want to read the file and sort the contents by date and then group by year. How can I do this in Jekyll Liquid?

Related

How to preserve cell formatting when exporting CSV from Gnumeric

I have a column with dates formated as dd/mm/yyyy when I export a CSV file the date is yyyy/mm/dd
How can I maintain the correct date format in the exported file?
Thank you.

How to convert a text date into the short date format in excel

I have a database of dates that I need to map to another table in my MySQL database. The format of one table is listed as:
Dec 01 2020
And the other is listed as:
12/01/2020
My plan is to take all the text dates from table 1, convert to short date in excel, create a new table in MySQL, then re-map them to the short date in table 2. How can you convert the text date in excel so that it matches the format of the short date (12/01/2020)? I have tried using text to columns and other date functions in excel but have had no luck. Thanks in advance!
One can use REPLACE to place a , after the day number and Excel will then be able to convert it to a date. Then Simply format it as desired:
=--REPLACE(A1,7,0,",")

CSV file using mixture of date formats

I've been producing a csv file from Salesforce Marketing Cloud. The date column is using two different date formats for seemingly random dates:
How can I stop it from doing this? I have also exported it from SFMC in a text format, and all the dates are in the same format in that file, but as soon as I convert it to CSV it puts them in this variety of formats. Can anyone help?
Excel tries to fix it for you. You should import into excel using the' Data Tab > Get External Data'. As you import make sure you select the correct date format for the column with your dates. ie MM/DD/YYYY h:mm:ss AM/PM.

Extract date from a string using Talend

I am receiving CSV files daily which have header like
"AD PERFORMANCE REPORT (Jan 24, 2016)".
I would like to extract date from it and use it as date column using Talend.
How can I do that?
For change the format of a specicif column in other format, you can use the "tExtractRegexFields", with your regex for get just your date.
tFileInputDelimited --> tExtractRegexFields --> tMap --> tFileOutputDelimited
After get the date in your string with the 'tExtractRegexFields' component, you can specifyy the type of date in your output Schema like that :
the pattern of your date (Jan 24, 2016) is "MMM d, yyyy"
link for tExtractRegexField on Talend is here
link for a great website for test your regex is here
link for date Pattern in Jav is here
I used the following regex in tExtractRegexFields
"\(([^)]*)\)"

Excel import to MySQL: Date inserted as 0000-00-00

I have used PHPExcel library to import an Excel file (.xlsx) and insert into MySQL. I'm facing two problems with the date field:
1- In the excel sheet I try to change the date format to the desired one. Upon saving, the cells show the format I need (yyyy/mm/dd) but when I double-click to edit them they again change back to how it was before (mm/dd/yyyy).
2- When the file is imported to MySQL through PHPExcel all the columns are inserted correctly except the date column which inserts 0000-00-00. The format in the Excelsheet is the same as in MySQL but it enters is all zeros.
Please help!
The value store in PHPExcel is an Excel serialized datetime value (a float, representing the number of days since 1/1/1900 or 1/1/9004 depending on whether Windows or Mac Calendar was used). Changing the format is simply changing the way this value is displayed.
You will either need to know in advance whether a cell contains a date, or test it using the PHPExcel_Shared_Date::isDateTime() method, and convert it appropriately. You can then either retrieve it using getFormattedValue() to return the value as a formatted string; or use the built-in conversion functions to convert it to a unix timestamp (PHPExcel_Shared_Date::ExcelToPHP()) or a PHP DateTime object (PHPExcel_Shared_Date::ExcelToPHPObject()) that you can then format using the standard PHP date formatting functions before using it in your MySQL INSERT/UPDATE statements.
Change the date format to yyyy-mm-dd, save the file as CSV and import that into your database.