Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index

On 02/09/2013 02:21 AM, Alex Thurgood wrote:
On 02/08/2013 11:15 PM, Joel Madero wrote:

Hi Joel,

I have some vague recollection that the Date function in Calc (i.e. the
one used when entering manually) and the Date function in Basic are not
the same...

You could always see whether any of the methods used in this Java
snippet, taken from the API documentation, are of any use :

/** Writes a date with standard date format into a spreadsheet.
         @param xSheet  The XSpreadsheet interface of the spreadsheet.
         @param aCellName  The address of the cell (or a named range).
         @param nDay  The day of the date.
         @param nMonth  The month of the date.
         @param nYear  The year of the date. */
     public void setDate(
             String aCellName,
             int nDay, int nMonth, int nYear ) throws RuntimeException,
         // Set the date value. xCell = xSheet.getCellRangeByName(
aCellName ).getCellByPosition( 0, 0 );
         String aDateStr = nMonth + "/" + nDay + "/" + nYear;
         xCell.setFormula( aDateStr );

My understanding of this snippet is that you have to specifically
convert the separated values of your date string to INT, and then
introduce the separators so that once inserted altogether in a cell,
Calc will interpret it as a date, and format it according to your locale.


Alex, you are a cheater :-)

Never occurred to me to set the formula to a formatted string and let calc figure out it is a date.

But now that you say it....

Duh! smack head.

Andrew Pitonyak
My Macro Document:

For unsubscribe instructions e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.