[Solved] Convert text string from CSV to date

Discuss the spreadsheet application
Locked
S.Franklin
Posts: 1
Joined: Mon Jun 03, 2024 2:54 am

[Solved] Convert text string from CSV to date

Post by S.Franklin »

I have a string in a .csv file that is like '20241009' and, when I try to convert it I get some negative info like "10/09/-8220"
What's my problem? (Kind replies only, please) ;-)
Last edited by MrProgrammer on Wed Oct 09, 2024 6:54 pm, edited 2 times in total.
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
OpenOffice 4.1.15 Arcolinux
User avatar
MrProgrammer
Moderator
Posts: 5430
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: convert text string to date

Post by MrProgrammer »

Hi, and welcome to the forum.
S.Franklin wrote: Wed Oct 02, 2024 11:50 pm I have a string in a .csv file that is like '20241009'
Read [Tutorial] Text to Columns. Set the Column Type for those dates to Date (YMD). You probably want to select Detect Special Numbers in the dialog. To ensure a successful import the important task is to review all the options in the Text Import dialog and guide Calc to interpret your CSV file columns correctly. Accepting all the defaults in the dialog is a common source of trouble. Once you have correctly imported the dates in the CSV file you can change their display formats in your sheet to whatever you want using Format → Cells → Numbers → Date or, better, using a style.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.

[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Locked