[solved] Dates as DDMMYY to DD Mon Year

Discuss the spreadsheet application
Post Reply
excalibur21
Posts: 2
Joined: Thu Feb 21, 2008 7:07 am

[solved] Dates as DDMMYY to DD Mon Year

Post by excalibur21 »

The fixed length data that I receive shows a data as ddmmyy. I have not been able to find a way to get it to change to a true date eg 200208 show as 20 Feb 2008
thanks all. when I import it I change the cell type to text in order to preserve the leading zeroes. I then do as you all suggested
DATE("20"&RIGHT(A1,2),MID(A1,3,2),LEFT(A1,2)) IN Excel
DATE("20"&RIGHT(A1;2);MID(A1;3;2);LEFT(A1;2)) in Calc

with the cells formatted to an appropriate date type
Last edited by excalibur21 on Mon Feb 25, 2008 6:58 am, edited 2 times in total.
User avatar
kingfisher
Volunteer
Posts: 2123
Joined: Tue Nov 20, 2007 10:53 am

Re: Dates as DDMMYY to DD Mon Year

Post by kingfisher »

Have you looked at the functions LEFT, MID and RIGHT? You can subdivide the number and enclose the parts within the DATE function. Example: =DATE(RIGHT(A3;2);MID(A3;3;2);LEFT(A3;2))

You can format the cell containing the formula with the menu Format >Cells : Numbers
Apache OpenOffice 4.1.9 on Linux
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Dates as DDMMYY to DD Mon Year

Post by acknak »

I don't think there is a way to adjust Calc's automatic date recognition, so that DDMMYY (e.g. "022108") would be recognized as a date and converted to an internal date value on input.

You can, however, use a formula to do the conversion after the data are input, as long as they're input as text values.

Would that work for you?

(kingfisher's example is just what I was thinking of)
AOO4/LO5 • Linux • Fedora 23
User avatar
kingfisher
Volunteer
Posts: 2123
Joined: Tue Nov 20, 2007 10:53 am

Re: Dates as DDMMYY to DD Mon Year

Post by kingfisher »

There is no need for the original data to be entered as text.
Apache OpenOffice 4.1.9 on Linux
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Dates as DDMMYY to DD Mon Year

Post by Villeroy »

Is 200208 a number or text value? If text, always 6 chars? Why don't you tell us what you tried and which unexpected result you get? "200208" becomes "23 Feb 2448"? This would explain everything.

=DATE(RIGHT(A3;2);MID(A3;3;2);LEFT(A3;2)) works with fixed chars of 6 decimals only.
I would have thought that this can not work since DATE expects 3 numeric arguments. Apparently DATE converts on the fly.

You won't get 6 digits from all numbers, even when 10208 is formatted to show 010208.
=TEXT(A1;"000000") generates the 6 digit string from where you can proceed with the kingfisher's formula.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
kingfisher
Volunteer
Posts: 2123
Joined: Tue Nov 20, 2007 10:53 am

Re: Dates as DDMMYY to DD Mon Year

Post by kingfisher »

If a leading 0 is omitted, the example requires amendment, obviously. The DATE function accepts digits extracted from a text entry or from a numerical entry.
Apache OpenOffice 4.1.9 on Linux
Post Reply