Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6620305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:04:52+00:00 2026-05-25T21:04:52+00:00

So from what I have found I would have to write a swap method?

  • 0

So from what I have found I would have to write a swap method? Only problem is from the codes I have been looking over it is a bit over my head.

I am getting a value from a xml file, for example “20120411” What I would like it to be once passed to another string is April 11, 2012, or at least 04/11/12. I have found simple ways to do this in just about every other language besides java. If its simple enough for someone to show me the code to accomplish this, or point me in the right direction I would appreciate it!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:04:53+00:00Added an answer on May 25, 2026 at 9:04 pm

    Look at using a SimpleDateFormat object. There are many many examples of how to use this in this forum, and so a little searching will bring you riches. If you look this over and still are stuck, then you should consider showing us your attempt and tell us what’s not working for you, and we’ll likely be able to easily help you.

    A format String to try includes “yyyyMMdd”. You’d construct your SDF object with this String, parse the xml String and thereby turn it into a Date object. You’d use a second SDF object with a different pattern String, perhaps “MMMM dd, yyyy” to format the Date into a different String. Again, give it a try!

    e.g.,

    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    public class SdfTest {
       public static void main(String[] args) {
          SimpleDateFormat sdfInput = new SimpleDateFormat("yyyyMMdd");
          SimpleDateFormat sdfOutput = new SimpleDateFormat("MMMM dd, yyyy");
    
          try {
             Date date = sdfInput.parse("20120411");
             String output = sdfOutput.format(date);
             System.out.println(output);
    
          } catch (ParseException e) {
             e.printStackTrace();
          }
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just moved job and gone from VB 6 to VB.Net and found
I have to use a smart pointer and I found shared_ptr from boost looks
So: I have the following function, adapted from a formula found online, which takes
com/jniwrapper/win32/ie/WebBrowser class not found. From where can I download jniWrapper library. I have downloaded
I would like to write an html/javascript/sql app for personal use only running locally
We have been going through a big memory leak analysis and have found one
I would like to have thread-safe read and write access to an auto-implemented property.
I have found one open source project with the basic excel functionality, write cell,
I have an error handling method in my ApplicationController: rescue_from ActiveRecord::RecordNotFound, :with => :not_found
I have two queries, as following: SELECT SQL_CALC_FOUND_ROWS Id, Name FROM my_table WHERE Name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.