Incrementing a date in openrefine - openrefine

I have a date in format of YYYY-MM-DDThh:mm:ss
Please provide a GREL expression that increments date to 1 month from the present date value for all cells in the column in openrefine. Thanks!

First you need to make sure the data in the cells is of type 'date' - if the text in the cell is in green then the data is already 'date' type. Otherwise you will need to convert it using the GREL:
value.toDate()
Screenshot - before converting to date
Screenshot - after converting to date
Once you have the data as Date type, then you can use the following GREL to increment by one month:
value.inc(1,'month')
For more on using dates in OpenRefine see https://github.com/OpenRefine/OpenRefine/wiki/GREL-Date-Functions

Related

Converting VarChar Column with multiple date format to single date column with proper format

I have data of transaction dates in one column within varchar format.
This column contains three separate formats of date in dd-mm-yy, dd/dd/yyyy and third format in dd/mm/yyy format with missing the last digit.
How to modify this column in the correct date format column with the dd-mm-yyyy format.
Add a date column and fill with your convert statement to get the desired format. Once everything looks okay you can drop the text column and rename the new proper date column to match the original.

Convert Date to formatted date

I have a column for dates and the values are like this 1181202 and i want to convert it to normal date format "02-12-2018" so i can compare it with another date however when i am trying the following it returning wrong year and date
SELECT CONVERT(Datetime, Text_UPD_DATE,106) -- i have tried all numbers
From Notes
it's returning 5134-01-09 00:00:00.000
Can you please advise on the correct command
At a total guess, based on your one example:
CONVERT(date,'20'+STUFF(Text_UPD_DATE,1,1,''),112)

VBA date format code

I was wondering if there is any possibility to write a VBA code where the column A should always have a date format like this: 12.10.2017 (not 12/10/2017 or 12-10-2017). If anything else is written in the column A like "12" or "car" the entry should be deleted. It has to accept only the date format mentioned above.
I used data validation for this, with length 10 and the date format to take only "." into consideration, but I want to do it as a VBA code instead.
Thanks!
A valid date is a long representing the number of days since the 1st january 1900. So a valid date would be 45603. You can display this date in any format you wish using the format codes d, m and y . So to display the date as dd.mm.yyyy then set that numberformat in the cells in column A. Your problem though is that Excel will only accept a date entered as either a long or in a built in date format (using /, - or space as a separator). You could allow the users to enter a text string in the format dd.mm.yyyy and then convert that string into a date and then reject it if the conversion didn't result in a valid date - but wouldn't it be easier to just train your users to enter dates correctly?

convert TEXT dd/mm/yyyy in SQL column to DATE YYYY-MM-DD

I would love to know the best way to handle data that has been inputted incorrectly as dd/mm/yyyy into a sql database as TEXT and to have it converted into a new column of the table with the datatype as DATE so it is actually stored as yyyy-mm-dd.
Existing text date column name is called "olddate" with an empty column created called "truedate" to house the new data. Each row has the date field, but none are able to be sorted correctly because of this issue.
Any ideas how I can slice and dice the current date into a new DATE field friendly version?
Thanks in advance :-)
That is style 103. So use:
select convert(date, col, 103)
Are you using Oracle? If so, TO_DATE is what you want. You can take in a string that represents a date and convert it to a date using the format you pass it.

Converting mmyy into a useable date

My question is very similar to this problem, but for Excel: how do I convert mmyy to last day of month in netezza or this one: Create a date from Credit Card expire in MMYY format.
Essentially I have a column filled with dates that have been written as mmyy i.e.
0215
0215
0215
0315
0315
The column has been saved as the data type: "Special".
How do I convert this data into a useable format? I don't mind if we put it into dd/mm/yyyy and use the first or the last day of the month that's fine. Is there an Excel function that I could use or is this something I would have to do in VBA and if so, how?
With the 'dates' starting in A2, use this formula in an unused column to the right,
=DATE(20&RIGHT(A2, 2), LEFT(TEXT(A2, "0000"), 2), 1)
Fill down as necessary. You will have to format as a date or you will receive the raw date value like 42064.
If you need the end-of-month, add 1 to the month and change the day to 0 like,
=DATE(20&RIGHT(A2, 2), LEFT(TEXT(A2, "0000"), 2)+1, 0)
30 characters:
=1*REPLACE("1/"&A1,5,1,"/201")
Subject to the dates concerned the 20 may be redundant.
use this
=DATEVALUE("01/"&LEFT(A1;2)&"/20"&RIGHT(A1;2))
do not forget to change Format Cells to "Date" for column "B"