How to automatically enter date separator on libreoffice calc - libreoffice

How to automatically enter date separator on libreoffice calc?
e.g.: I type 26112020 on a cell and when I hit Enter or leave the cell I would like this value to be automatically formatted/changed to 26/11/2020. This date format is DD/MM/YYYY (but I think it doesn't matter, right?).
Also, it would be nice if I could do the same with time, e.g.: entering 1235 would automatically format/change to 12:35.
I think I just need to put a / or a : in the entered value.
Thanks

Related

How do I change the date format from MM/DD/YYYY to DD/MM/YYYY in libreoffice calc?

I have a spreadsheet with existing date values that I'd like to convert from MM/DD/YYYY to DD/MM/YYYY format. Is there any way of doing this?
The spreadsheet comes from a csv file from someone else that i have opened in calc.
Select the cells with the dates and in Cell -> Format, choose the date format you wish (DD/MM/YYYY)
Making sure the cells are selected, go to Data -> Text to columns choose "Separated by" and "Tab" and click "OK"
Cells should now have the desired format
Cut (or copy then erase) all values from the column (CTRL + X).
Choose Edit -> Paste Special -> Unformatted text (MAJ + CTRL + ALT + V).
On "Fields", click on your column, then select "Date (MDY)". It is important here to select the format the data currently is, NOT the format you want it to be.
If date is still not OK, you will need to follow this additional step (response above from #cybernetic.nomad):
Select the cells with the dates and in Cell -> Format, choose the date format you wish (DD/MM/YYYY).
NB: Note that my LibreOffice Calc is not in english so I am not 100% sure about the option names.
You select the cells to format, then you press Ctrl-1 (or choose "Format" - "Cells..." from the menu, or any other way) to open the dialog to format cells. There is a text field "Format code" where you enter "DD/MM/YYYY" without the quotation marks. Click "OK".
If that does not format the date like you want, the value in the cell is not interpretable as a date. Investigate the cell's value, you might have a text marker (a single apostrophe ') as the first character.
To check this out and experiment with the formats, choose "Insert" - "Date" from the menu. It puts the current date into the current cell.
Disclaimer: Since my Calc is not set to English, the names of menus and their entries might be different. I just guessed how they could be named.
EDIT:
If you can't change the cell format because the date is constantly recognized as "text", you might like to try this:
Insert a column right from the date column. This produces in your case the column O. All columns right of it are pushed to the right.
Put this formula in cell O2 on the right of the first date text:
=CONCATENATE(MID(N2;4;3);MID(N2;1;3);MID(N2;7;4))
It takes snippets (MID()) from cell N2 and concatenates them in the new order. Details of the functions are in Calc's documentation.
You will need to adjust N2 to the correct cell reference if it is not the cell directly left of the cell you're entering the formula.
Put the cell cursor on N2.
Press these key combinations in sequence to mark a deep enough range of cells in column O: Control-Down, Right, Shift-Control-Up. The cell cursor will be on cell O2 now, and the range below and including it is marked.
Now press Control-D to copy the formula in O2 into each cell in the range.
Now you will have a new column O with the text of N, but exchanged characters. The values are still "text", though.
If you like, you can shrink the width of column N now, or hide it.
Example:
Input wanted: DD/MM/YYYY (31/12/2021)
Input accepted: MM/DD/YYYY (12/31/2021)
First add new Date type
Go to Format --> Cells
In "Category" select "Date"
In "Format code" write the input wanted. In this case DD/MM/YYYY
Press the green check
Second format style
Go in the cell where you want to add the date
Write the date in the wrong format. Example: 12/31/2021 (for 31st December 2021) even if you want 21/11/2021
Select that cell and press CTRL-X. The text should disappear
Select that now empty cell and do: Edit -> Paste Special -> Pase unformatted text
The date should be there in the wrong format
Select that cell with the wrong date and do: Format --> Cells
In "category" select "date" and double click on the newly added date type (aka DD/MM/YYYY)

How to format date in libre office

I have a column of dates in a format below:
Fri Dec 25 02:45:23 MYT 2015
Fri Dec 25 17:38:57 MYT 2015
How do I change it to a format as below:
2015-12-25
2015-12-25
I have tried to format cells but it is not working. Any idea ?
At first the Calc must accept those strings as dates. I don't know if any Asian language versions will do that. Default English and German language versions don't.
So at least with default English and German language versions, first there is a need to convert the strings into default date strings.
I've done this with the formula:
=--(LEFT(A1;11)&RIGHT(A1;4)&MID(A1;11;9))
Then applied the format YYYY-MM-DD HH:MM:SS on the cells.
Change column type when opening the file and try to format cells as any format you need.
Assume that dates are in column A.
1. Insert new column B to the left of old column B.
2. In B1, input: =Value(A1)
3. Select B1, right click -> format Cell -> Numbers -> date -> choose the required format
4. Apply this to all column B rows.
5. Select all of column B.
6. Copy all column B cells (with CTRL-C).
7. Select Edit from the menu.
8. Select Past Special from the menu.
9. In the dialog box that opens, unselect formulas, select the desired conditions, and press OK.
10. You can now delete column A.
11. Save ASAP.
If a cell is formatted as text (#) then everything you enter in the cell is treated as text.
You can eliminate all the apostrophes in those cells:
Change the text format in the range to date format.
with Find & Replace:
Find: .*
Replace: &
In more options: mark selected range and regular expressions.
Select the range if not selected.
Replace All.
If the column is text... my LO version has the CALC function DATEVALUE [DATUMWERT in German], which converts a date text string to a date value

LibreOffice: Cells with text to date

I have loaded an xlsx file where the original author used Microsoft Office to create the file. In the spreadsheet, there is a column of dates given in format like "DD/MM/YYYY TT:MM:SS", but they are stored as text. Furhteron, "DD/MM/YYYY TT:MM:SS" is not locale default. I cannot find a way to make LibreOffice interpret it as date. Can someone please help me to reach my aim?
Highlight the column of dates. From the menu, select Data -> Text to columns. In the dialog window that pops up, press "OK". That should do it.

Crystal Reports Parameter Input dialog box changing the date format

When I generate a report that expects two date parameters, I first see the dialog box titled 'Enter Values' and the dialog box contains two text boxes with its own date picker widget. However, once I pick a date and click 'OK', the date is formatted as 'dd/MM/yyyy'. Does anyone know if it is possible to configure the report in a way so that the date format matches Windows system locale short date format? Instead of just defaulting to dd/MM/yyyy?
Thanks!
The date format for the parameter can't be changed, at least as far as I know. If you want the date displayed in a different format, you can always create a formula:
"From : " & ToText(Minimum({?date}), "M-d-yy") &
" To :" & ToText(Maximum({?date}), "M-d-yy")
Or you can go into the File menu, click on Options and under the Fields tab, there is a button for Date. Click on that and you can choose the format under the Date tab. This is for CR 2008, so it may be slightly different for CR XI.
If You are trying to filter in your SQL on date range field then you can add castings on dates. Like
datarangeField between cast({?Start Date} as date format 'm-d-yy')
AND cast({?End Date} as date format 'm-d-yy')
Also, you are required to add these (Start Date and End Date) in your SQL Parameters during Adding the query.
For display you can use formulas and format field options.

Add date to to Crystal Report Text Object

I have a Text Object on my report which is contains some text. What I'd like to do is add a date to the text object that will alaways show the current date. I've tried using a date field, but it is near impossible to line it up correctly.
Any ideas on how to do this? I've been told that there is a way to do this using something like &[], but I can't figure out how.
Thanks!
You can edit the date inline, double click on the text field then select the date text, you can now click on the formatting button on the toolbar and setup the date format.
You can drag any field, including special ones (Print Date for example) into text object - it will line up without problems.