[Gllug] OpenOffice Calc date formats

Andrew Farnsworth farnsaw at stonedoor.com
Fri Jun 26 13:01:34 UTC 2009


On Fri Jun 26  8:45 , Tim Schofield  sent:

>On Fri, 2009-06-26 at 11:35 +0100, lesleyb at herlug.org.uk wrote:
>
>> I'll need to repeat this operation so I want to find a solution.
>> I could do it nongraphically working solely on the csv file before it gets to
>> Calc but I was wondering if anyone knows a date/time function that would convert 
>> on the fly in Calc?
>
>I have had a similar problem before and here is my nongraphically perl
>one liner to reformat the date field.
>
>perl -MDate::Manip -F, -l -a -n -e "@F[0]=&UnixDate(ParseDate(@F[0]),'%
>d/%m/%Y');print join(',', at F)" test.csv 
>
>
>@F[0] is because my date was in first column so change both occurrence
>accordingly.
>
>man Date::Manip for formats other than %d/%m/%Y.
>
>My csv file did not have field headers and the fields were unquoted, so
>you may need to sed -e 'd1;s/"//g' the file first.

This was going to be my suggestions as well.  On an interesting side note, read
the documentation on the Date::Manip module, especially the section that starts
out "Should I use Date::Manip"... the author says No... Read the docs and you
will understand but for this task it is perfect.

Andy
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list