JAXB and formating a date

Hi,
i have a problem:
The java-classes generated by JAXB from the following code-snipplet
    <xs:attribute name="edate" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:date"/>
      </xs:simpleType>
    </xs:attribute>produce during marshalling a string like "2000-01-22+01:00".
How can I suppress the +01:00 (which I assume to be the offset
from my local timezone to GMT)? Adding a pattern restriction doesn't work.
Is it possible to modify the DateFormat used by JAXBs internal classes to
achieve my goal?
Thanks

You can define your own conversion for the date inside your XML-Java binding Schema (XJS):
<xml-java-binding-schema>
<element name="date"
         type="value"
         convert="ConvertDate"/>
<conversion name="ConvertDate"
            type="java.util.Date"
            parse="ConvertDate.parse"
            print="ConvertDate.format"/>
</xml-java-binding-schema>
ConvertDate contains two methods that help the marshalling and
unmarshalling process convert to and from java.util.Date.
import java.util.*;
import java.text.*;
public class ConvertDate {
   static final SimpleDateFormat _format =
      new SimpleDateFormat("yyyy.MM.dd");
   public static Date parse(String date)
      throws ParseException {
      synchronized(_format) {
         return _format.parse(date);
   public static String format(Date date) {
      synchronized(_format) {
         return _format.format(date);
}

Similar Messages

  • Convert String to Date and Format the Date Expression in SSRS

    Hi,
    I have a parameter used to select a month and year  string that looks like:    jun-2013
    I can convert it to a date, but what I want to do is,  when a user selects a particular month-year  (let's say "jun-2013")
    I  populate one text box with the date the user selected , and (the challenge Im having is)  I want to populate a text box next to the first text box with the month-year  2 months ahead.    So if the user selects 
    jun-2013   textbox A will show  jun-2013 
    and textbox B will show  aug-2013..
    I have tried:
    =Format(Format(CDate(Parameters!month.Value  ),  
    "MM-YYYY"  )+ 2  )   -- But this gives an error
    This returns the month in number format   like "8"    for august...
    =Format(Format(CDate(Parameters!month.Value  ), 
    "MM"  )+ 2  )
    What is the proper syntax to give me the result    in this format =  "aug-2013"  ???
    Thanks in advance.
    MC
    M Collier

    You can convert a string that represents a date to a date object using the util.scand JavaScript method, and then format a date object to a string representation using the util.printd method. For more information, see:
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1254.html
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1251.html
    In your case, the code would be something like:
    var sDate = "2013-01-10";
    // Convert string to date
    var oDate = util.scand("yyyy-mm-dd", sDate);
    // Convert date to new string
    var sDate2 = util.printd("mm/dd/yyyy", oDate);
    // Set a field value
    getField("date2").value = sDate2;
    The exact code you'd use depends on where you place the script and where you're getting the original date string, but this should get you started.

  • Formatting a date in cfselect

    Assuming a query "meetingdate" that grabs a unique value of
    the 'meetingdate' field (a date/time field). In a form, that query
    is used to populate a cfselect command.
    The dropdown boxes now contain "yyyy-mm-dd hh:mm:ss" value
    (as in "2006-06-12 12:23").
    How do I format the drop-down values into 'mm/dd/yy", as in
    "06/12/06" ? Using the formatdate in the 'display' argument of the
    cfselect command returns an error.
    Or, should the query command contain some sort of formatdate
    function (and what would that be)?
    Thanks....Rick...

    Use appropriate SQL functions to format the field in the
    query, would
    depend on the DBMS system you are using (MSSql, MYSql,
    Access, Oracle, etc).
    OR
    Use <select> instead of <cfselect> where you can
    use a basic loop to
    populate the <option> tags and format the date in the
    loop.
    OR
    Use a Query of Query or manually build a query out of the
    original query
    modifying the format of the date string and use this new
    query in the
    <cfselect> tag.
    rhellewell wrote:
    > Assuming a query "meetingdate" that grabs a unique value
    of the 'meetingdate'
    > field (a date/time field). In a form, that query is used
    to populate a cfselect
    > command.
    >
    > The dropdown boxes now contain "yyyy-mm-dd hh:mm:ss"
    value (as in "2006-06-12
    > 12:23").
    >
    > How do I format the drop-down values into 'mm/dd/yy", as
    in "06/12/06" ? Using
    > the formatdate in the 'display' argument of the cfselect
    command returns an
    > error.
    >
    > Or, should the query command contain some sort of
    formatdate function (and
    > what would that be)?
    >
    > Thanks....Rick...
    >

  • ADF 10g Allow Multiple Date Formats During Data Entry

    We would like the ability to allow users to enter a date in several different formats. When they tab from the date field (or click out), we would like a custom java method (which we can write) to execute which analyzes what they typed and formats the date as MM/dd/yyyy. Can we do this and how do we get it to execute BEFORE any other validators and/or converters? A simple example is this: the user enters a forward slash (/) into a date field, they tab out, and we populate the date field with the current date.
    Any help and/or ideas is greatly appreciated.
    Thanks,
    Tracy

    Hi,
    actually you will write your own converter and use this instead of the default converter. This is the way you do it. It also ensures that the timing between validation a conversion is fine
    Frank

  • Data Recovery from Partitioned and formatted Bit Locker Encrypted Drive

    Recently because of some issues in windows 7 installation from windows 8 installed OS. it was giving as the disc is dynamic windows can not be installed on it. so at last after struggling hard no other solution i partitioned and formatted my whole
    drive so all data gone included the drive which was encrypted by bit lockers.
    For recovery i used many software such as ontrack easy recover, get data back, recovery my files professional edition but still i couldnt able to recover my data from that drive. then i found some suggestion Using CMD to decrypt my data first 
    http://technet.microsoft.com/en-us/library/ee523219(WS.10).aspx
    where it shows it successfully decrypt my data at that moment my drives were in RAW format excluding on which windows is installed and then in CMD i check Chdsk which also shows no problem found. but now problem is still i coudnt able to recover
    my data then i format the drive D and again tried to recover data using above software after decryption still no result. 
    Now i need assistance how i can recover my encrypted drive as it was partitioned and also formatted but decrypted also as i have its recovery key too. thanks

    Hi ,
    I am afraid that we cannot get the data back if the drive has been formatted even if use the
    BitLocker Repair Tool.
    You’d better contact your local data recovery center to try to get data back.
    Tracy Cai
    TechNet Community Support

  • Dependant Dropdown - Format string as date?? And hopefully two dates as a range?

    I'm stuck - been trying to figure this out all afternoon and with a launch in 2 days am probably missing something obvious....so please help me!! hehe<br />I have the a dependent drop down.  The first one is a list of Locations and the second one is then populated by a list of dates that events will be at those locations.<br /><br />1st problem:  when I've been hand coding this drop down I am able to show the start and end date with something like:<br />echo date( 'l, M j', $row_getalldates['date_start']).' - '.date( 'M j',$row_getalldates'date_end']);<br /><br />b How do I translate that into one string to display in wdg:displayfield=""<br /><br />2nd:  Right now since I can't get the two values in...I'm just going with one value so I can continue with development till I figure it out.  <br /><br />I cannot get the date formatted as I usually do with the date() function I usually use. See: http://camp.studentlife.com/housing2/index.php?op=addinfo<br /><br />b SQL STATEMENT:<br />$query_getalllocations = "SELECT distinct(b.title),locationid FROM calendar a LEFT JOIN sllocations b USING (locationid) WHERE b.title is NOT NULL and a.date_start>$mstart_date and a.date_start<$mend_date AND (a.calid='1' ) GROUP BY b.title ORDER BY b.title ";<br />$getalllocations = mysql_query($query_getalllocations);<br />$row_getalllocations = mysql_fetch_assoc($getalllocations);<br />$totalRows_getalllocations = mysql_num_rows($getalllocations);<br /><br />$colname_getalldates = "-1";<br />if (isset($_GET['locationid'])) {<br />  $colname_getalldates = $_GET['locationid'];<br />}else{<br />     $colname_getcalendar = "-1";<br />     if (isset($_GET['eventid'])) {<br />       $colname_getcalendar = $_GET['eventid'];<br />     }<br />     <br />     $query_getcalendar = sprintf("SELECT * FROM calendar WHERE eventid = %s", GetSQLValueString($colname_getcalendar, "int"));<br />     $getcalendar = mysql_query($query_getcalendar);<br />     $row_getcalendar = mysql_fetch_assoc($getcalendar);<br />     <br />     $colname_getalldates =$row_getcalendar['locationid'];<br />     mysql_free_result($getcalendar);<br />}<br /><br />$query_getalldates = sprintf("SELECT a.* FROM calendar a WHERE locationid = %s and a.date_start>$mstart_date and a.date_start<$mend_date ORDER BY a.date_start ASC", GetSQLValueString($colname_getalldates, "int"));<br />$getalldates = mysql_query($query_getalldates);<br />$row_getalldates = mysql_fetch_assoc($getalldates);<br />$totalRows_getalldates = mysql_num_rows($getalldates);<br /><br />b ABOVE MY HEAD TAG:<br />//begin JSRecordset<br />$jsObject_rs_alldates = new WDG_JsRecordset("rs_alldates");<br />echo $jsObject_rs_alldates->getOutput();<br />//end JSRecordset<br /><br />b AND INSIDE MY FORM:<br /><select name="location" class="required" id="location" tabindex="1"><br />   <option value="0" <?php if (!(strcmp(0, $row_rs_alllocations['locationid']))) {echo "selected=\"selected\"";} ?>>SELECT LOCATION</option><br />   <?php<br />do {  <br />?><br />   <option value="<?php echo $row_rs_alllocations['locationid']?>"<?php if (!(strcmp($row_rs_alllocations['locationid'], $row_rs_alllocations['locationid']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rs_alllocations['title']?></option><br />   <?php<br />} while ($row_rs_alllocations = mysql_fetch_assoc($rs_alllocations));<br />  $rows = mysql_num_rows($rs_alllocations);<br />  if($rows > 0) {<br />      mysql_data_seek($rs_alllocations, 0);<br />       $row_rs_alllocations = mysql_fetch_assoc($rs_alllocations);<br />  }<br />?><br />    </select></span></label></p><br />  <p><label><span><br />    <select name="date" class="required" id="date" tabindex="2" wdg:subtype="DependentDropdown" wdg:type="widget" wdg:recordset="rs_alldates" wdg:displayfield="date_start" wdg:valuefield="eventid" wdg:fkey="locationid" wdg:triggerobject="location" wdg:selected="SELECT YOUR CAMP DATE" ><br />    </select></span></label></p><br />1st I though it was the wdg:selected parameter that I could just throw make echo date( instead of just echo.   But no...that would be too easy ;)<br /><br />I figure its either in the "echo $jsObject_rs_alldates->getOutput();" above the head or hard coded into the included ADDT javascript files. Don't mind if I have to hard code as the site's lifespan is short

    Hi Amanda,
    how about preparing that within your query by using a CONCAT function and by formatting the dates right in here, like:
    SELECT CONCAT(DATE_FORMAT(date_start, '%I, %M %j')," - ",DATE_FORMAT(date_end, '%M %j')) AS date_range ?
    The wdg:displayfield expects one table column, and in this case it would be the alias column "date_range".
    Works ?
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Format of date and numbers

    Hi,
    in Italy the format of date is DD/MM/YYYY e the formato of numbers is NNN,DD (DD means Decimal).
    I use Excel for IPAD but when I write for instance 28/03/2015 the field shows 03/28/2015, the same problem is for numbers where the comma and the dot are inverted.
    How do I change the format of date and numbers?
    Thank you in advance.
    Max

    The general format of the date is tied to the language...use US english, get US date formatting.
    You may want to poke around in excel's settings. I know the desktop version allows you to alter the date formatting, but I'm not sure if the iPad app has that. Look for 'cell formatting' in the settings and see if it's alterable.
    If not, you can try to make your template on a PC, then put that excel onto your iPad and see if it honors the cell formatting already in place.

  • MS Word Web Service Interface: bad format of date and currency fields

    Hi,
    I am using MS Word Web Service interface to create contract documents. However, my date and currency fields show in a strange format. Date is in"YYYY-MM-DD" format, while currencies always have "." as decimal separator (probably technical values). My user settings are "DD.MM.YYYY" for dates and "n.nnn,dd" for decimal numbers.
    My workaround is to create a Z structure for WS interface with char fields and then do conversion through CRM_WST_RT_BADI->OUTBOUND_PROCESSING method. This works, but requires a lot of custom development.
    Is there a way to "tell" the interface to use correct formats in MS Word without doing it all manually through custom fields?
    Thanks!
    KR,
    Igor

    Oh, indeed!
    We might be closer than you think - I live close to Croatian-Slovenian border so we might pop out for a drink! But we can discuss this out of forum... 
    Now work again:
    Is there any documentation on possible formatting keywords? I suppose it's possible to set up decimal places, custom date formats etc.
    Cheers,
    Igor

  • Line graph date sorting and formatting

    Hi Gurus
    We've recently upgraded to 11.1.1.7 and noticed that our Publisher line charts with date on the x-axis are no longer sorting correctly i.e. May comes before March. The reason for this is because in <11.1.1.7 we have a formatted date mask (to_char) in our data model but sorted by the underlying canonical date which worked. Now in 11.1.1.7 it is no longer sorting by the data model sort but by the formatted date string therefore numeric values of 30 April sorted after 1 May.
    We have tried a number of options to resolve:
    1. using the canonical date and sorting on that corrects the sort problem but the default formatting used in long YYYY-MM-DDT00:00:00-00:00 and not readable as our chart is showing daily totals. Changing to time-series chart can allow you to format the date but see problem 2 next...
    2. Time series = yes doesn't display the chart if we have a number of entities in our series i.e. multiple lines and the interactive viewer shows a red error icon. I think this may be due to the fact that our date range is not continuous ie we have a sparse data set.
    3. Workaround we used was a bar chart (our users preference is line charts) with time series = false but the date format is still long.
    Any advice / suggestions would be helpful.
    Thanks
    Nick.

    for #1: numbers does what is called a "stable" sort. Meaning that the previous sort order is preserved. i.e. do your sort in reverse order. Amount, then name, then date. Just did it with sample data and it was perfect. It keeps them in the original order, so if there is a match in name after you sort, you should see the amount still in the proper order.
    #2: What in your formula isnt working? I just made a formula that did math on the columns to the left, sorted and it worked. Sorted by static data columns and the formula column. I know it was broken originally, years ago, but it seems to be working correctly now, at least in my quick test. You might have an issue if you are using formulas that refer to data on other rows or tables.
    #3: yeah formatting can be a pain. But it is easier to do in the desktop program. No, you cannot get it for windows, sorry. If the formatting the only thing you need to do on the desktop side, then i dont see much tying you to it. I do 90% or more on the ipad and iphone now.
    Jason

  • 01.01.0000 date parse and format

    Could somebody explain is wrong here?
    SimpleDateFormat frm = new SimpleDateFormat("yyyyMMddHHmmss");  // formatter
    frm.setTimeZone(TimeZone.getTimeZone("UTC"));   // UTC time zone
    // --- No problem for the next code ---
    String inDate = "19700101000000";  // 01.01.1970 input date
    long stamp;
    try {
        stamp = frm.parse(inDate).getTime();   // input date in long
    } catch (ParseException ex) {
        System.out.println("Interruption");
        stamp = 0;
    String outDate = frm.format(stamp);  // output date
    System.out.println("inDate=>" + inDate + "_longDate=>" + stamp + "_outDate=>" + outDate);
    // --- No idea why next code is working wrongly ---
    inDate = "00000101000000";  // 01.01.0000 input date
    try {
        stamp = frm.parse(inDate).getTime();   // input date in long
    } catch (ParseException ex) {
        System.out.println("Interruption");
        stamp = 0;
    outDate = frm.format(stamp);  // output date
    System.out.println("inDate=>" + inDate + "_longDate=>" + stamp + "_outDate=>" + outDate);I try to parse and format the time stamp 01.01.0000 00:00:00. On the finish I have 01.01.0001 instead of the correct 01.01.0000
    inDate=>19700101000000_longDate=>0_outDate=>19700101000000
    inDate=>00000101000000_longDate=>-62167392000000_outDate=>00010101000000

    You are calling format with a long parameter. The only format that matches that signature that I can see would be Format.format(Object) assuming autoboxing is changing the long to a Long.
    Format.format(Object) eventually calls DateFormat.format(Object, StringBuffer, FieldPosition). I have never used this method so I am not sure what it does.
    Was your intention to actually call this method?
    See the following example:
    System.out.println("Test 1: " + frm.format(new Long(0l), new StringBuffer(), new FieldPosition(0)));  
    System.out.println("Test 2: " + frm.format(new Long(-62167392000000l), new StringBuffer(), new FieldPosition(0)));  
    Test 1: 19700101000000
    Test 2: 00010101000000Edited by: jbish on Apr 26, 2013 12:43 PM
    Edited by: jbish on Apr 26, 2013 1:09 PM

  • How to put continuos (desired format) of dates in numbers spreadsheet and how to do it? please reply asap i need it..

    how to put continuos (desired format) of dates in numbers spreadsheet and how to do it? please reply asap i need it..

    This is the definition for "continuo" from Apple's dictionary:
    continuo |kənˈtinyəˌwō | (also basso continuo) noun (pl. continuos) (in baroque music) an accompanying part that includes a bass line and harmonies, typically played on a keyboard instrument and with other instruments such as cello or bass viol.
    Presumably you mean something else. Your chances of getting replies that can help you will improve with a clearly stated question.
    SG

  • Installed m4 crucial SSD and I cannon erase and format new drive. I get an error "wiping volume data to prevent future accidental probing failed"

    Installed m4 crucial SSD and I cannot erase and format new drive. I get an error "wiping volume data to prevent future accidental probing failed." any suggestions? Thanks.

    are you trying to format/erase it while it's in your Macbook?
    I have 2 Crucial M4 SSD.
    Connect via external USB.  Boot your computer with your old hard drive and proceed with the erase feature if you're planning on cloning your drive.

  • DACF: GridControl and formatted Date

    Hello,
    In JDev 3.2.2 (915), GridControl cannot paint formatted Date of null value:
    EmpImpl.getHiredate() = 1981-12-03
    EmpImpl.getHiredate() = null
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    void javax.swing.JComponent._paintImmediately(int, int, int, int)
    void javax.swing.JComponent.paintImmediately(int, int, int, int)
    void javax.swing.RepaintManager.paintDirtyRegions()
    void javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run()
    Reproducing:
    - using wizards, create ApplicationModule on SCOTT.EMP table, application and DataForm with grid;
    - using Design mode, set formatterInfo for HiredateMasterCol: Format as Date, Custom "dd.MM.yyyy";
    - run application, try to insert new row.
    Could anybody suggest me a workaround ?
    Thanks,
    -Arkadi

    This is a bug in 3.2. here is world around which JDev team suggested.
    - //extend DafualtDateFormater(add this to your panel/frame code)
    class MyDateFormatter extends DefaultDateFormatter{
    String myDate="";
    public String format(String fmtStr, Object rawData){
    try{
    myDate= ( (rawData == null ) ? "" : super.format(fmtStr,rawData));
    }catch(Exception ex){
    return myDate;
    - //instantiate new DateFormater(add this at top of jbInit())
    MyDateFormatter newDateFmr = new MyDateFormatter ();
    DefaultFormatManager mgr = DefaultFormatManager.getInstance();
    mgr.replaceFormatter(DefaultFormatManager.DATE_VALUE, newDateFmr);
    null

  • What is Internal and External format in data source

    Hi friends,
    can any body explain me about Internal format and External format
    while we creating datas0ource. on what basis we choose these.
    could any plz explain me.
    Thanks in advance,
    Thanks and Regards,
    Madhavi

    Hi Madhavi,
    In BW the Internal Format of data is different then external format (the one we use in general) for example date is stored in the format as "YYYYMMDD".
    Now if you are loading some data in BW where the Format is different than YYYYMMDD then you have to convert it using Conversion Routines.
    Please go to SE37 and put CONVER and you can find a  lot of conversion routines , alternatively you can go to infoobject and in General tab you can use F4 help dropdown for various conversion routines available in BW.
    Hope it Helps
    Thanks
    CK

  • Format users date and repopulate

    Hi, I've been having a lot of trouble with what is probably a very easy solution. What I am trying to do is create a function which reads a passed in date and either alerts the user with an error message saying the format is wrong, or (preferably) reformats the date and replaces the original.
    ie;
    Textbox1 : user enters 10/11/2008
    Script: converts to dd/mmm/yyyy
    Textbox2 now reads 11/OCT/2008
    the other format I want to allow is mmm//yyyy (where a month is known but a specific day of the week is not)
    only requirement is to check for those 2 formats. I know Adobe allows for validation of a single date format, but unfortunately, I need 2.
    please help if you can. thanks

    To get some flexability in the validation and formating you definately need to use JavaScript.
    To check for three date formats, one correct formats and two for conversion, you'll need to first write Regular Expressions for all three. After this it's a matter of figuring out if the input matches any of these and then applying the appropiate action, either converting, complianing, or doing nothing. All of this can be done from the validate event.
    As an alternative, you could use the keystroke event to limit the kinds of input the user can type into the field in the first place.
    Here are some articles that are relavant to your task:
    http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/date_time_part1/
    http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/formatting_text_field s/
    http://www.acrobatusers.com/tutorials/2008/04/text_match_reg_exp/
    http://www.acrobatusers.com/tech_corners/javascript_corner/tips/2006/scripts_form_fields/
    You'll also find detailed tutorials on using the Validate and Keystroke events at www.pdfscripting.com
    Thom Parker
    The source for PDF Scripting Info
    www.pdfScripting.com
    The Acrobat JavaScript Reference, Use it Early and Often
    http://www.adobe.com/devnet/acrobat/

Maybe you are looking for

  • Hello, I want to know if you buy a iPhone in EEUU yo can use this iphone in Spain

    hello, I want to know if you buy a iPhone in EEUU yo can use this iphone in Spain.

  • ERROR in running a Form

    Hi I have installed Oracle 10g DS in my PC successfully.But while i am running the form i am getting internet explorer error and the browser is shutting down. But i am not having any problem to run a oracle report. Can anybody help me out from this p

  • Tab in PPOME (no subscreen found)

    Hello everyone, I have a problem with one tab that i created in my PPOME. I already created several ones, but for one of them, I have the error message "no subscribe found" Like the other tab that i created, I have a dynPro 7000 in my IT and i put da

  • Benefits of PHP in the context of SAP

    Could it be that PHP and SAP integration people do not how to approach it. The concerntration and effort is where the true money is...... Java and ABAP. I think what we all need to start doing is discussing the benefits of using PHP with SAP. Why sho

  • Can you do without option 60 if you're doing windows dhcp?

    Can you do without option 60 though if you're doing windows dhcp? I don't want to use option 60 and I have done this with IOS dhcp but I want to do the same with Windows DHCP! Any help would be appreciated.I have a dedicated subnet for the DHCP and w