I18n for custom date format strings

I want to internationalize dates shorter than DateFormat.SHORT, in the form "M/d". For example, when the Locale is US, January 16 should display as 1/16, but if the Locale is MX (Mexico), it should display as 16/1.
It seems like a very simple problem date formatting problem, but it doesn't look like the DateFormat/SimpleDateFormat classes have any way of doing this. Am I missing something?
--Steven                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

You need to apply your own customized date pattern to get the formats you want. I suggest you put the patterns in resource bundles...the default pattern in your default bundle, and the Mexican pattern in your bundle for Mexico. Then do something like this:
<pre>
<code>
String newPattern = "M/d"; // retrieve from bundle instead
Date today = new Date();
DateFormat df = DateFormat.getInstance();
SimpleDateFormat simpleFormat = (SimpleDateFormat)df;
simpleFormat.applyPattern(newPattern);
System.out.println(df.format(today);
</code>
</pre>

Similar Messages

  • Custom Data Format

    I am using the new version of numbers and cannot find an option for custom data format. Has it been removed or am I missing something? Can someone point me out where it is? Either that, or let me know how to get a bigger currency list as the currency I am wanting is not there.

    Hi Cullen,
    Thank you for this workaround. I did as you said, and it works, unlike copy and paste from Numbers 2.3 to Numbers 3.0 .
    In Numbers '09 (version 2.3) I created two Custom formats.
    Column A is the inbuilt Date and Time format showing only the Date (my region's date format is Day Month Year).
    Column B is a Custom Format to show short Month, space, short year.
    Column C is the inbuilt format for Number.
    Column D is a custom Format to show leading zeroes.
    Then I did as you said and saved the Numbers 2 document (as a document for future use, not as a Template, because I am not sure how Templates are shared between the two versions on Numbers).
    Then File, option key > Save As... a new name to preserve my original from harm by Numbers 3.0 .
    In Numbers 3, (as you said) open the spare copy and the Custom formats are indeed listed. Format Inspector > Cell > Data Format
    And they do work. Here is where I edited the cell content by entering new values from the keyboard:
    I shall place a link to this thread on the thread named "Workarounds in Numbers 3.0?"
    https://discussions.apple.com/message/23622372#23622372#
    Thanks for this.
    Regards,
    Ian.

  • Custom Data Formatting Gone for Dates

    Another new aspect of the updated Numbers app for OS X is the loss of customizing data formats.  There are more options via a drop down, but there's less customization.  For example.  I had a use case where I'd take a column full of dates and would replicate it so the same data was in two columns.  I then was able to customize the first column of dates to use a month shortcode only so it would render "Jan, Feb, Mar, Apr..." depending on the data in that column.  The next colum with the same data I'd then customize to show only the day of the month.  See the example below.
    Date
    Column 1
    Date
    Column 2
    Jan
    4
    Mar
    15
    Oct
    23
    Presently, neither the shortnames for months by themselves nor the day of the month by itself is available as an option when working in the Data Format panel.
    I'm assuming the customization was killed, but if someone knows if that's hidden elsewhere, please let me know!

    Hi Bret,
    I don't know the answer to your actual question as I tend to later adoption, and am not yet using Numbers 3.0, but here's a workaround (with some limitations, noted below).
    Limitations:
    Requires that the values in the cells are created by formulas, or can be created by formulas referencing another cell.
    The resulting values will be a text string (column A) or a numeric value (column B), not a Date and Time value.
    A: =LEFT(MONTHNAME(MONTH(formula)),3)
    B: =DAY(formula)
    In each, formula is the existing formula used to determine the D&T value currently in the cell.
    Regards,
    Barry

  • Custom date format is not working for me

    I have a bunch of dates imported from another spread sheet. They look like this:
    February 04, 2014 at 09:24AM
    Numbers 3.2 sees this as Text, so I went about making a custom date format. It looks like this:
    However, I cannot make Numbers see it as a date. It keeps saying it is a string. If I select the cell containing the date and set the format to "My Custom Format", nothing happens - at all.
    What am I doing wrong?
    Thanks in advance,
    Michael

    Hi Michael,
    The Custom format you designed will display a normal Dave and Time value in the way your import presents it. That's not what you want though.
    To comvert the imported format to a regular Numbers format, use a conversion expression in a new column.
    Assuming your Imported Date is in Column B, Insert a Column and use this expression:
    =DATEVALUE(LEFT(B, LEN(B)−11))+TIMEVALUE(RIGHT(B, 7)
    Format your new column to the way you want to see Date/Time in your document.
    Jerry

  • Not able to save date column with custom date format. in OBIEE 11g

    Hi,
    I have migrated one report from OBIEE 10g to 11g. There is a date column with customized date format(i.e. Default format is 'dd-MMM-yyyy' and I have used 'MMM-yyyy').
    But when I use this custom format and try to save the report in 11g its giving this below error.
    ''Catalog object privilege validation failed for user to path /shared/ALM BI/Finacial Results/History Income Statement Detail.
    You do not currently have sufficient privileges to save a report or dashboard page that contains HTML markup.
    This HTML might be present in column headings, table headings, text views, narrative views, the print header,
    or the print footer and must be removed before saving.''
    Please let me know what changes I need to do for this.
    Regards,
    Ambika Nanda.

    Hi ,
    privilage issues...check the security settings once..
    Thanks,
    Ananth

  • How to get the system date format string?

    Hello, everybody!
    I want to create a MaskFormatter with a mask for dates. So, I could suply as the constructor parameter: "##/##/####'. However, what if the year comes first in the current system date format settings, or the month is in the second place or in the first?... So, I can't just suppose that the current locale format for dates is like the one above. So, my question is: is there a way to get the SYSTEM DATE FORMAT STRING in Java? Searching in google I saw that this was already asked in this forum:
    http://forum.java.sun.com/thread.jspa?threadID=301034&messageID=1193794
    but there was no effective answer. Does someone already know how to get this?
    Thank you.
    Marcos

    Hi, not sure, but
    import java.text.*;
    SimpleDateFormat sdf = new SimpleDateFormat();
    System.out.println(sdf.toPattern());
    will output something like dd/MM/yy HH:mm
    hthThank you very much. It worked.

  • Custom Date Format in Apex 3.2

    Can I define a custom date format at global level. I am able to select the following date formats only. However, I want to specify a custom date format i.e YYYYMONDD.
    12-JAN-04
    12-JAN-2004
    12-JAN
    04-JAN-12
    2004-01-12
    Monday, 12 January, 2004
    12-JAN-2004 14:30
    12-JAN-2004 14:30:00
    12-JAN-2004 02:30PM
    January
    16 hours ago
    Thanks in advance for the help.
    CM

    Hi,
    You can type to field your custom format.
    Br,Jari

  • Pages custom date format

    I'm looking for a way to create a custom date format outside a Pages formatted cell. In other words, in text paragraphs, I need to be able to update the year only in a paragraph. Any ideas?

    If you are looking for the capability within Pages to insert a custom date field-code like the following, outside of a table, then I am not aware of how it can be done. I used LibreOffice 4.0 to produce the following image.
    When this was exported as a .docx file into Pages v4.3 on Mountain Lion, the YYYY format was replaced by a Pages date field. A right-button selection of this date in Pages offers an Edit Date & Time... menu item that produces the following panel:
    There is no YYYY format customization on this panel within Pages.
    It is possible to write an AppleScript service that runs from your Pages > Services menu and scans your Pages document for a date to convert to a YYYY replacement format. You may not want that either.
    Did this answer your question?

  • Bad date format string in Crystal 2013

    I have a report that I wrote a formula to convert the date from a number to a date recognizable by the end user. It works fine. The user then wanted to add another field to the same report. Same type of deal, so I copied the first formula into a new formula for the second conversion and simply changed the file name that it was pulling from. When I check the formula, it comes back no errors found, but when I insert it into the report, I get an error that says "Bad date format string" it's the exact same formula that runs fine in the field next to it. What am I  missing? The exact formula as used is;
    date(mid(totext({File.name},0,' '),5,2)+'/'+ right(totext({File.Name},0,' ' ),2) + '/' + left(totext({File.Name},0,' '),4)) It is intended to take it from 20140405 to 04/05/2014.
    Any help would be greatly appreciated. As I am new to Crystal reports and by no means a database administrator by trade.
    Thanks
    Bob V.

    hi Bob,
    you can use something like the following
    stringvar s:= '20140405';
    date(s[1 to 4] + '/' + s[5 to 6] + '/' + s[7 to 8])
    and if you want to be safe and use a check, then you can use something this
    stringvar s:= '20140405';
    s:= s[1 to 4] + '/' + s[5 to 6] + '/' + s[7 to 8];
    if isdate(s) then date(s);
    -jamie

  • Is there any system variable for this date format 01/21/2004 18:00:32

    Hello,
    Is there any system variable for this date format 01/21/2004 18:00:32
    This is my Internal date format and my External date format is sy-datum.
    How can I validate....any suggestions will be apprecaited!
    Regards,
    Kittu

    Hello,
    Thank you very much for your response!
    My internal date format is 01/21/2004 18:00:32
    and external date format on selection-screen is sy-datum.
    My external format is stored in S_crtsp
    and internal format is stored in L_crtsp. (01/21/2004 18:00:32)
    I want to remove the time from the internal format and validate it aginst the external format.
    Any suggestions or brief explonation is appreciated...I apprecaite the help soo far...
    Regards,
    Kittu

  • String maniplute for exampl Date format

    hello every body i need some help with this program.
    Req:
    INPUT:
    date in this form "mm/dd/yyy" range from "1000<=yyyy<=3000"
    OUTPUT:
    Example:
    Enter a date: 05/01/2005
    05/01/2005
    01/05/2005
    2005-05-01
    May1, 2005
    01 May 2005
    5/1/05
    That what I did so far, pleas I need your help
    import java.lang.*;
    import java.util.Scanner;
    public class string control
       public static void main (String [] args)
       Scanner scan = new Scanner(System.in);
       String input;
       String day;
       String month;
       String year;
       System.out.print("Enter a date: ");
      input = scan.nextLine();
      int pos= input.indexOf (' ');
      month = input.substring (0,4);
       input = input.substring(pos+1,input.length());
       day= input.substring(0,input.indexOf(' '));
       int locmonthchar = input.indexOf(' ')+1;   // to break it & make it esaier.
      year= input.substring(input.indexOf(' ')+1,input.length());
       String newinput = year + ","+month+day.charAt(0);

    Programer2010 wrote:
    just write each string as a function
    for example: public string getDay()...No. Don't do this if you can avoid it. Use SimpleDateFormat (as suggested above) and with different format strings is in my mind the simplest, most straightforward, and likely correct (if this is homework) answer. check out the API.

  • Custom error message for invalid date format

    Hi,
    I am using af:selectInputDate component for date. When i enter wrong date format it comes up follwoing pop up error message:
    The value "12/13/2009" is not a valid date. Valid example ""29/11/2005".
    However i dont want to show this standard message but a customised error message like "the value is not in correct format...".
    Can anyone help me how can i show customised message.

    Hi Kiran
    Try these options
    1) Change your <b>Internet Explorer</b> [The Browser which you are using] language
    2) In Application Level, ie in Webdynpro
    a)Go to <b><Your project name>>Webdynpro>Applications--><Your Application>
    Double click on your Application name</b>b) Go to Application Properties TAB, Add a New Application Property
    c) Click on "<b>Browse</b>" and Select <b>DefaultLocale</b> and mention the Value as
    <b>en_US</b> [If you didnt mention any thing here by default it will take browser's language]
    3)In your Portal check the language setting of particular user in identity management
    Warm Regards
    Chaitanya.A

  • Deserializing error for the Data format

    Hi,
    We have created a RFC FM. Which will be call from other non-sap system.
    Where other non-sap system was using dot net.
    While they are calling our custom RFC there are getting a problem with date format. The error says as follows
    - <n0:SimpleTransformationFault xmlns:n0="http://www.sap.com/transformation-templates">
                <MainName>/1BCDWB/WSS0070718161009712605</MainName>
                 <ProgName>/1BCDWB/WSS0070718161009712605</ProgName>
                 <Line>74</Line>
                 <Valid>X</Valid>
    - <DeserialisationFault>
                <DescriptionText>An error occurred when deserializing in the simple transformation program /1BCDWB/WSS0070718161009712605</DescriptionText>
                 <DescriptionDetailText>The date 20060728 is not a valid date according to the XML format for ABAP</DescriptionDetailText>
                <TreePosition />
                <ClassName>CX_SY_CONVERSION_NO_DATE_TIME</ClassName>
                </DeserialisationFault>
    - <Caller>
                <Class>CL_SRG_RFC_PROXY_CONTEXT</Class>
                <Method>IF_SXML_PART~DECODE</Method>
                <Positions>1</Positions>
                </Caller>
      </n0:SimpleTransformationFault>
    Could any one help me out regarding this deserialize error with date from?
    Thanks in Advance
    Regards,
    Gopinath Addepalli.

    I believe you may still have issues with your migration. I would first verify that you can perform some basic functions with PWA:
    1) Create, save and publish a new project from browser.
    2) Edit, save and publish one of the migrated projects.
    3) Before doing the migration, do you have all the approvals completed and projects published.
    4) Clear out your cache and try a different project to open.
    5) Open Server Settings, go to Delete Objects and see if your projects are listed for deletion.
    Cheers!
    Michael Wharton, MVP, MBA, PMP, MCT, MCTS, MCSD, MCSE+I, MCDBA
    Website http://www.WhartonComputer.com
    Blog http://MyProjectExpert.com contains my field notes and SQL queries

  • Custom Date format in InfoPath DatePicker without code

    Hello,
    I am trying to customize the date format in my date picker on my InfoPath form. I went to the date picker properties and was able to change it so that it displays the format in "14-Mar-01" but I want to really customize and have it formatted to look
    like the following "MMM-YY" format. Is there a way to go about setting this format without custom code? I am unable to use any server side code for my forms.
    Thank you!

    Hi,
    According to your post, my understanding is that you want to customize the date format like “MMM-YY” without custom code.
    The date format which is set in InfoPath Form is different from the date column’s default format in SharePoint.
    In SharePoint, the default format of the date column is depended on the selection of the “Time Zone”, “Region”, “Calendar” options in the “Regional Settings” of Site Settings.
    However, the date format which is set in InfoPath Form only works on the items’ NewForm, EditForm, DispForm in the lists.
    I recommend that you can create a calculated column based on the date column with this formula: =TEXT(Date,"MMM-YY").
    Then, you can modify view to display the calculated column and hide the date column in the list.
    The result is shown as below:
    Thanks,
    Yumi Fu
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]

  • Custom date format -every time? dd/mm/yy

    I'm ding my first biggish form so there is a list of issues I'm trying to resolve here, bear with me...
    I'm in europe and we like the dd/mm/yy date format but this isn't a default option to choose from so I have to put in custom, dd/mm/yy every time I want a date field. I have around 12 per form at the moment so is there not a way for Acrobat to 'remember' it, even within the document, never mind the 'prefs' for the whole program. I can't find anything under language or international options.
    Thanks,
    Matt

    After setting it, right-click the field and select "Use current properties
    as new defaults".

Maybe you are looking for

  • Conversion of Vendor data from legacy to SAP

    Hi Gurus, In our conversion process, we have converted our legacy system vendors to SAP. After our conversion, during our validation, we have pulled data from LFA1 (pulled Vendor and Account Group), LFB1 (Pulled Vendor and Previous Account Number - A

  • Segment delimiter causing error

    Hi Guru's We had setup an outbound 810 in b2b. The issue is when EDI file is generated( validations r off) and we look it through spec builder we get following error The Interchange Trailer is missing. The segment itself may be missing or the Segment

  • I-tunes is disabled

    I am trying to buy songs on both my PC and I-phone and it says I-tunes is disabled. I enabled I-tunes store with no success.

  • SU22 authorization checks

    Hello, We are looking at solving all Priority 1(RED) and Priority 2(YELLOW) errors appearing in SU22 for release 6 and 7. I have some understanding of how the errors come up. I have a few concerns. 1) How do we decide whether to set proposal value as

  • Book format lost

    My wife has successfully created and printed a book using Aperature 2.1 - love it! Now a few months later she wants to modify and reprint the book. But when she opens the project, there is just all the photos used, displayed in the browser/viewer vie