Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I convert timestamp string to milliseconds?

Tags:

android

time

How can i convert this time and date which coming from json data in android to milliseconds properly ??

2013-09-19T03:27:23+01:00

and what's the meaning of T ??

like image 915
eng.ahmed Avatar asked Dec 01 '25 14:12

eng.ahmed


1 Answers

not sure about and what's the meaning of T ?? but you can use following code to get milliseconds.

String dateString="2013-09-19T03:27:23+01:00";
        if (dateString != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
            Date testDate = null;
            try {
                testDate = sdf.parse(dateString);
            } catch (ParseException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            System.out.println("Milliseconds==" + testDate.getTime());

        } 
like image 69
Ketan Ahir Avatar answered Dec 07 '25 03:12

Ketan Ahir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!