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 7899509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:43:15+00:00 2026-06-03T08:43:15+00:00

I want to convert date time object in java to json string in format

  • 0

I want to convert date time object in java to json string in format as below:

{"date":"/Date(18000000+0000)/"}

I did like this but it didn’t give me the format i desired:

JSONObject object = new JSONObject();
object.put("date",new Date());

and the result of object.toString()

{"date":"Fri May 04 11:22:32 GMT+07:00 2012"}

i want the string “Fri May 04 11:22:32 GMT+07:00 2012” transform to “/Date(18000000+0000)/” (18000000+0000 here is just a example).

Thanks for your help.

  • 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-06-03T08:43:16+00:00Added an answer on June 3, 2026 at 8:43 am

    The date format that you want is /Date(<epoch time><Time Zone>)/.
    You can get the epoch time in java using long epoch = System.currentTimeMillis()/1000;(found at this link) and the time zone you can get by using the date and time patteren as Z. Then combine all the strings into one and store it to the Json Object.
    Other possibility is that the time you are getting from iOS device may be of the pattern yyMMddHHmmssZ as got from here. Check the output on the iOS device at different times and identify the correct pattern.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to convert this string into DateTime. Tue Aug 19 15:05:05 +0000 2008
I want to convert a string like 2012-03-08T00:00:00+01:00 into Date.. I tried to use
I have a date string that looks like the following javascript format. I want
I want to convert array of objects to json encoding, I make like this
I Looking for a method that convert time string into Calendar look like this:
I have strings like 84, 03 etc. that I want to convert to Date
I want to convert String to Date in different formats. For example, I am
I have a Date format: 2009-08-10T16:03:03Z that I want to convert to: @MMM dd,
Using PHP, I want to convert UNIX timestamps to date strings similar to this:
How do I convert a string to a date object in python? The string

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.