Page 1 of 1

[Solved] How to set date format in Header

Posted: Thu Feb 24, 2011 9:21 am
by Idrees
Hi all,
I'm currently creating a spreadsheet and I'm having trouble with date format in header its appearing 02/24/2011. But I want changed it with system date format like 24/02/2011.
and whenever I open the sheet current system date will appear in report through header.

Thanks.

Re: How to set date format in Header

Posted: Thu Feb 24, 2011 11:00 am
by Zizi64
Hi,

See:
http://user.services.openoffice.org/en/ ... =9&t=34113
http://user.services.openoffice.org/en/ ... =9&t=33604

and see the attached file. In attached file there are some Basic examples, How can convert the date to an user formatted string, and how you can put a string from a cell to a footer (to a PageStyle) automatically. Focus on the green cells, and the macro!
Running_foot_macro3.ods
(22.83 KiB) Downloaded 376 times

Re: How to set date format in Header

Posted: Thu Feb 24, 2011 5:47 pm
by MrProgrammer
If you want dates displayed in DD/MM/YYYY format, just change your locale to one that uses that date format. The locale setting is in OpenOffice.org, Preferences, Language Settings, Languages on a Mac and in Tools, Options, Language Settings, Languages on other platforms. For example, the English (UK) locale would use the DD/MM/YYYY format. There are many locales and I'd start by selecting the one for your country to see if that meets your needs.

If this answered your question please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.

Re: How to set date format in Header

Posted: Tue Mar 29, 2011 12:51 am
by craig1103
MrProgrammer wrote:If you want dates displayed in DD/MM/YYYY format, just change your locale to one that uses that date format.
I was going to beg to differ, but after hours spent researching this issue and reading bugs 51662, 5556, 72229, 106992 and 30216, I've realised that the bottom line is that OOo ignores one's settings in Windows' "Regional and Language Options" control panel applet. The setting you're referring to is the one inside OOo, which is hard-coded to use date formats (and other things) that the developers have decreed are correct for that particular locale. I suppose it's difficult to argue with this top-down wisdom, but as an OOo user I'd sure like more control over my environment (as I do through the Windows "Regional and Language Options" control panel applet), rather than having my environment dictated to me by those who "know better".

In my case, being an international standards-oriented kinda guy (although many other users have more compelling reasons, such as legal requirements), I'd prefer to use the ISO 8601 format for short dates, which is YYYY-MM-DD, but according to OOo we Canadians are supposed to be using DD/MM/YYYY. I followed various instructions involving changing styles, default templates, etc., but these did not work for me. I can, of course, change the format that is displayed, but not the format that OOo (Calc in particular) uses outside of, for want of a better word, the "facade" of what is displayed in the finished product. Someone even suggested changing my locale to Uyghur, which uses the ISO 8601 date format, but this introduces other complications, not the least of which is another alphabet! I don't have the time to go through the several dozen other locales to find one that uses the ISO 8601 date format and the English language.

The following screen capture illustrates the problem succinctly. It shows two cells, both of which contain the date 24 April 2011. The top cell is being edited, and shows the DD/MM/YYYY format while it is being edited (which is also displayed in the formula bar), but once I hit enter or tab it then displays the YYYY-MM-DD format, which is what I want and have set as the format of these cells. Ironically, I can enter a date in the YYYY-MM-DD format and it will display that way, but OOo still converts and stores it in the DD/MM/YYYY format.
Editing a cell.
Editing a cell.
ooo_cell_edit.gif (1.95 KiB) Viewed 7246 times
The other screen captures show my Windows "Regional and Language Options" control panel applet (in following message, as I can only upload three attachments per message), my OOo language options, and the format of a date (28 March 2011) automatically inserted into a footer.

If, in all of my reading, I've missed some obvious way that I can have OOo "think" in the YYYY-MM-DD format (instead of the DD/MM/YYYY format) as well as display in the YYYY-MM-DD format, I'd sure appreciate being set straight.

Re: How to set date format in Header

Posted: Tue Mar 29, 2011 12:54 am
by craig1103
craig1103 wrote:The other screen captures show my Windows "Regional and Language Options" control panel applet (in following message, as I can only upload three attachments per message) ...
Here it is:

Re: How to set date format in Header

Posted: Thu May 17, 2012 6:47 pm
by dphaynes
This seems pretty crazy. I've searched everywhere for how to change date formats, no joy. I even searched through all the files in the install directory hoping to find some text or XML configuration I could edit - nothing obvious in there.

I've downloaded the sources to see if there is anything that can be done though I don't know when I'll have a chance to look so don't hold your breath :roll:

If anyone has run across a solution since this thread was last updated, I'd love to hear it.

Re: How to set date format in Header

Posted: Fri May 18, 2012 2:45 am
by kingfisher
Do you have the problem in Windows or Ubuntu or both?

Looking back through the thread, it seems that the OP is referring to the page header. If you can't find a solution to that, you could switch that header off and use a cell in your print range for a header.

Re: How to set date format in Header

Posted: Sat May 19, 2012 9:32 am
by Villeroy
This date format follows Tools>Options>LanguageSettings>Locale (assumed language for all numerals in the whole office suite) and can not be overridden. From this locale setting it derives the date representation with 4-digit years.
This Basic macro inserts a date string (don't know which).