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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:19:01+00:00 2026-05-31T09:19:01+00:00

I used SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy, HH:mm"); String time = formatter.format(new Date()); to

  • 0

I used

SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy, HH:mm");
String time = formatter.format(new Date());

to get the time (12.03.2012, 17:31), now i want to convert this time to milliseconds, because i have a file with a couple dates and text, and i want to convert the dates in milliseconds so that i cant add the text in inbox using

ContentValues values = new ContentValues();
values.put("address", "123");
values.put("body", "tekst");
values.put("read", 1);
values.put("date", HERE I MUST PUT A DATE IN MILLISECONDS);     
context.getContentResolver().insert(Uri.parse("content://sms/inbox"), values);

Because i must put a time in milliseconds i must convert the time, does anyone know how?

Let’s say I have a time 05.01.2011, 12:45 and want to convert it, how? I want to convert an old time that I have (not to get miliseconds from current time).

  • 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-31T09:19:02+00:00Added an answer on May 31, 2026 at 9:19 am

    The simplest way is to convert Date type to milliseconds:

    SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy, HH:mm");
    formatter.setLenient(false);
    
    Date curDate = new Date();
    long curMillis = curDate.getTime();
    String curTime = formatter.format(curDate);
    
    String oldTime = "05.01.2011, 12:45";
    Date oldDate = formatter.parse(oldTime);
    long oldMillis = oldDate.getTime();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get the difference between two Java Date objects. I've used Joda-Time
how to format 2011-10-25T13:00:00Z string into date and time i used simple date format
I want to convert my date (which is in String format), e.g. 13-09-2011, into
Try this: DateFormat df = new SimpleDateFormat(y); System.out.println(df.format(new Date())); Without reading the javadoc for
I have a string that contains a date, in the following format: dd-mm-yyyy with
I used SimpleDateFormat: SimpleDateFormat df = new SimpleDateFormat(yyyy/MM/dd hh:mm:ss); value.adStartDate = df.parse(2011/11/11 11:11:11); I
I need to convert epoch timestamp to date and time. I have used the
Javadocs on java.text.SimpleDateFormat state the following on the "z" pattern letter: z Time zone
I know of date formats such as yyyy-mm-dd -which displays date in format 2011-02-26
The time I used to develop applications on iPhone I was converting String to

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.