Convert microseconds to milliseconds without loss of precision and format as date-time in Java
up vote
1
down vote
favorite
How can I convert incoming long time value in microseconds
into milliseconds
and then format that to data time stamp as below:
yyyyMMdd-HH:mm:ss.SSS
I am using Java SimpleDateFormat
to format the long value to the timestamp. But, converting the microseconds to milliseconds seems problem as I am loosing the value.
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss.SSS");
To convert microsecond to millisecond, I am using the TimeUnit:
long micro //microseconds
long milli = TimeUnit.MILLISECONDS.convert(micro, TimeUnit.MICROSECONDS);
What is the right way to convert the value without loosing any data?
java timeunit
|
show 4 more comments
up vote
1
down vote
favorite
How can I convert incoming long time value in microseconds
into milliseconds
and then format that to data time stamp as below:
yyyyMMdd-HH:mm:ss.SSS
I am using Java SimpleDateFormat
to format the long value to the timestamp. But, converting the microseconds to milliseconds seems problem as I am loosing the value.
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss.SSS");
To convert microsecond to millisecond, I am using the TimeUnit:
long micro //microseconds
long milli = TimeUnit.MILLISECONDS.convert(micro, TimeUnit.MICROSECONDS);
What is the right way to convert the value without loosing any data?
java timeunit
What's you current input value and what's your expected output value?
– MadProgrammer
Nov 5 at 3:56
What does you mean with "I am loosing the value"? Can you provide a runnable Minimal, Complete, and Verifiable example, with appropriate sampel values for the microseconds, that shows what you wanted to happen and what happened instead?
– Erwin Bolwidt
Nov 5 at 3:59
1
Convert microseconds string to date in Java or Scala might help
– MadProgrammer
Nov 5 at 4:00
1
You should include sample data, indicating given inputs and expected outputs.
– Basil Bourque
Nov 5 at 4:48
1
uh, you are getting microseconds and want milliseconds without loss of precision. You are aware that 1000 microseconds go into a single millisecond and you're treating the number of milliseconds as an integer value. You are ALWAYS going to lose precision.
– jwenting
Nov 5 at 9:51
|
show 4 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
How can I convert incoming long time value in microseconds
into milliseconds
and then format that to data time stamp as below:
yyyyMMdd-HH:mm:ss.SSS
I am using Java SimpleDateFormat
to format the long value to the timestamp. But, converting the microseconds to milliseconds seems problem as I am loosing the value.
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss.SSS");
To convert microsecond to millisecond, I am using the TimeUnit:
long micro //microseconds
long milli = TimeUnit.MILLISECONDS.convert(micro, TimeUnit.MICROSECONDS);
What is the right way to convert the value without loosing any data?
java timeunit
How can I convert incoming long time value in microseconds
into milliseconds
and then format that to data time stamp as below:
yyyyMMdd-HH:mm:ss.SSS
I am using Java SimpleDateFormat
to format the long value to the timestamp. But, converting the microseconds to milliseconds seems problem as I am loosing the value.
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss.SSS");
To convert microsecond to millisecond, I am using the TimeUnit:
long micro //microseconds
long milli = TimeUnit.MILLISECONDS.convert(micro, TimeUnit.MICROSECONDS);
What is the right way to convert the value without loosing any data?
java timeunit
java timeunit
edited Nov 5 at 9:45
Ole V.V.
24.7k62349
24.7k62349
asked Nov 5 at 3:53
Jparak
91
91
What's you current input value and what's your expected output value?
– MadProgrammer
Nov 5 at 3:56
What does you mean with "I am loosing the value"? Can you provide a runnable Minimal, Complete, and Verifiable example, with appropriate sampel values for the microseconds, that shows what you wanted to happen and what happened instead?
– Erwin Bolwidt
Nov 5 at 3:59
1
Convert microseconds string to date in Java or Scala might help
– MadProgrammer
Nov 5 at 4:00
1
You should include sample data, indicating given inputs and expected outputs.
– Basil Bourque
Nov 5 at 4:48
1
uh, you are getting microseconds and want milliseconds without loss of precision. You are aware that 1000 microseconds go into a single millisecond and you're treating the number of milliseconds as an integer value. You are ALWAYS going to lose precision.
– jwenting
Nov 5 at 9:51
|
show 4 more comments
What's you current input value and what's your expected output value?
– MadProgrammer
Nov 5 at 3:56
What does you mean with "I am loosing the value"? Can you provide a runnable Minimal, Complete, and Verifiable example, with appropriate sampel values for the microseconds, that shows what you wanted to happen and what happened instead?
– Erwin Bolwidt
Nov 5 at 3:59
1
Convert microseconds string to date in Java or Scala might help
– MadProgrammer
Nov 5 at 4:00
1
You should include sample data, indicating given inputs and expected outputs.
– Basil Bourque
Nov 5 at 4:48
1
uh, you are getting microseconds and want milliseconds without loss of precision. You are aware that 1000 microseconds go into a single millisecond and you're treating the number of milliseconds as an integer value. You are ALWAYS going to lose precision.
– jwenting
Nov 5 at 9:51
What's you current input value and what's your expected output value?
– MadProgrammer
Nov 5 at 3:56
What's you current input value and what's your expected output value?
– MadProgrammer
Nov 5 at 3:56
What does you mean with "I am loosing the value"? Can you provide a runnable Minimal, Complete, and Verifiable example, with appropriate sampel values for the microseconds, that shows what you wanted to happen and what happened instead?
– Erwin Bolwidt
Nov 5 at 3:59
What does you mean with "I am loosing the value"? Can you provide a runnable Minimal, Complete, and Verifiable example, with appropriate sampel values for the microseconds, that shows what you wanted to happen and what happened instead?
– Erwin Bolwidt
Nov 5 at 3:59
1
1
Convert microseconds string to date in Java or Scala might help
– MadProgrammer
Nov 5 at 4:00
Convert microseconds string to date in Java or Scala might help
– MadProgrammer
Nov 5 at 4:00
1
1
You should include sample data, indicating given inputs and expected outputs.
– Basil Bourque
Nov 5 at 4:48
You should include sample data, indicating given inputs and expected outputs.
– Basil Bourque
Nov 5 at 4:48
1
1
uh, you are getting microseconds and want milliseconds without loss of precision. You are aware that 1000 microseconds go into a single millisecond and you're treating the number of milliseconds as an integer value. You are ALWAYS going to lose precision.
– jwenting
Nov 5 at 9:51
uh, you are getting microseconds and want milliseconds without loss of precision. You are aware that 1000 microseconds go into a single millisecond and you're treating the number of milliseconds as an integer value. You are ALWAYS going to lose precision.
– jwenting
Nov 5 at 9:51
|
show 4 more comments
1 Answer
1
active
oldest
votes
up vote
5
down vote
I am using java SimpleDateFormat
Don’t.
Avoid the treacherous old date-time classes bundled with the earliest versions of Java. They were supplanted years ago with the java.time classes when JSR 310 was adopted.
convert incoming long time value in microseconds into milliseconds
Don’t.
The java.time classes use a resolution of nanoseconds, finer than your microseconds. So no need to throw away data.
Instant
= ( whole seconds + fractional second as nanos )
Extract the number of whole seconds.
long seconds = TimeUnit.MICROSECONDS.toSeconds( micros ) ;
Get the fractional second, the amount of micros left over after subtracting for the whole seconds.
long microsRemaining =
micros
-
TimeUnit.SECONDS.toMicros( seconds )
;
Convert the remaining micros to nanos, because the Instant
class we use next represents a count of whole seconds plus a count of nanoseconds (for the fractional second).
long nanos = TimeUnit.MICROSECONDS.toNanos( microsRemaining ) ;
Combine the whole seconds with the fractional second in nanos. The Instant
class represents a moment in UTC as a count since the epoch reference of first moment of 1970 in UTC, 1970-01-01T00:00Z.
Instant instant = Instant.ofEpochSecond( seconds ).plusNanos( nanos ) ;
To generate a string in standard ISO 8601 format, simply call toString
.
String output = instant.toString() ;
The Z
on the end of the string means UTC (an offset-from-UTC of zero hours-minutes-seconds), and is pronounced Zulu
.
You can produce strings in your own custom formats using the DateTimeFormatter
class. Search Stack Overflow as this has been covered many many many times already.
Tip: Your desired format is so close to the ISO 8601 format, YYYY-MM-DDTHH:MM:SSZ, that I strongly suggest using the standard format rather than make up your own cousin of that.
If you wish to see this same moment through the lens of the wall-clock time used by people of a certain region (a time zone), apply a ZoneId
to get a ZonedDateTime
.
ZoneId z = ZoneId.of( "Africa/Tunisia" ) ;
ZonedDateTime zdt = instant.atZone( z ) ;
About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date
, Calendar
, & SimpleDateFormat
.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.*
classes.
Where to obtain the java.time classes?
Java SE 8, Java SE 9, Java SE 10, Java SE 11, and later - Part of the standard Java API with a bundled implementation.
- Java 9 adds some minor features and fixes.
Java SE 6 and Java SE 7
- Most of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.
Android
- Later versions of Android bundle implementations of the java.time classes.
- For earlier Android (<26), the ThreeTenABP project adapts ThreeTen-Backport (mentioned above). See How to use ThreeTenABP….
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval
, YearWeek
, YearQuarter
, and more.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
I am using java SimpleDateFormat
Don’t.
Avoid the treacherous old date-time classes bundled with the earliest versions of Java. They were supplanted years ago with the java.time classes when JSR 310 was adopted.
convert incoming long time value in microseconds into milliseconds
Don’t.
The java.time classes use a resolution of nanoseconds, finer than your microseconds. So no need to throw away data.
Instant
= ( whole seconds + fractional second as nanos )
Extract the number of whole seconds.
long seconds = TimeUnit.MICROSECONDS.toSeconds( micros ) ;
Get the fractional second, the amount of micros left over after subtracting for the whole seconds.
long microsRemaining =
micros
-
TimeUnit.SECONDS.toMicros( seconds )
;
Convert the remaining micros to nanos, because the Instant
class we use next represents a count of whole seconds plus a count of nanoseconds (for the fractional second).
long nanos = TimeUnit.MICROSECONDS.toNanos( microsRemaining ) ;
Combine the whole seconds with the fractional second in nanos. The Instant
class represents a moment in UTC as a count since the epoch reference of first moment of 1970 in UTC, 1970-01-01T00:00Z.
Instant instant = Instant.ofEpochSecond( seconds ).plusNanos( nanos ) ;
To generate a string in standard ISO 8601 format, simply call toString
.
String output = instant.toString() ;
The Z
on the end of the string means UTC (an offset-from-UTC of zero hours-minutes-seconds), and is pronounced Zulu
.
You can produce strings in your own custom formats using the DateTimeFormatter
class. Search Stack Overflow as this has been covered many many many times already.
Tip: Your desired format is so close to the ISO 8601 format, YYYY-MM-DDTHH:MM:SSZ, that I strongly suggest using the standard format rather than make up your own cousin of that.
If you wish to see this same moment through the lens of the wall-clock time used by people of a certain region (a time zone), apply a ZoneId
to get a ZonedDateTime
.
ZoneId z = ZoneId.of( "Africa/Tunisia" ) ;
ZonedDateTime zdt = instant.atZone( z ) ;
About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date
, Calendar
, & SimpleDateFormat
.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.*
classes.
Where to obtain the java.time classes?
Java SE 8, Java SE 9, Java SE 10, Java SE 11, and later - Part of the standard Java API with a bundled implementation.
- Java 9 adds some minor features and fixes.
Java SE 6 and Java SE 7
- Most of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.
Android
- Later versions of Android bundle implementations of the java.time classes.
- For earlier Android (<26), the ThreeTenABP project adapts ThreeTen-Backport (mentioned above). See How to use ThreeTenABP….
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval
, YearWeek
, YearQuarter
, and more.
add a comment |
up vote
5
down vote
I am using java SimpleDateFormat
Don’t.
Avoid the treacherous old date-time classes bundled with the earliest versions of Java. They were supplanted years ago with the java.time classes when JSR 310 was adopted.
convert incoming long time value in microseconds into milliseconds
Don’t.
The java.time classes use a resolution of nanoseconds, finer than your microseconds. So no need to throw away data.
Instant
= ( whole seconds + fractional second as nanos )
Extract the number of whole seconds.
long seconds = TimeUnit.MICROSECONDS.toSeconds( micros ) ;
Get the fractional second, the amount of micros left over after subtracting for the whole seconds.
long microsRemaining =
micros
-
TimeUnit.SECONDS.toMicros( seconds )
;
Convert the remaining micros to nanos, because the Instant
class we use next represents a count of whole seconds plus a count of nanoseconds (for the fractional second).
long nanos = TimeUnit.MICROSECONDS.toNanos( microsRemaining ) ;
Combine the whole seconds with the fractional second in nanos. The Instant
class represents a moment in UTC as a count since the epoch reference of first moment of 1970 in UTC, 1970-01-01T00:00Z.
Instant instant = Instant.ofEpochSecond( seconds ).plusNanos( nanos ) ;
To generate a string in standard ISO 8601 format, simply call toString
.
String output = instant.toString() ;
The Z
on the end of the string means UTC (an offset-from-UTC of zero hours-minutes-seconds), and is pronounced Zulu
.
You can produce strings in your own custom formats using the DateTimeFormatter
class. Search Stack Overflow as this has been covered many many many times already.
Tip: Your desired format is so close to the ISO 8601 format, YYYY-MM-DDTHH:MM:SSZ, that I strongly suggest using the standard format rather than make up your own cousin of that.
If you wish to see this same moment through the lens of the wall-clock time used by people of a certain region (a time zone), apply a ZoneId
to get a ZonedDateTime
.
ZoneId z = ZoneId.of( "Africa/Tunisia" ) ;
ZonedDateTime zdt = instant.atZone( z ) ;
About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date
, Calendar
, & SimpleDateFormat
.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.*
classes.
Where to obtain the java.time classes?
Java SE 8, Java SE 9, Java SE 10, Java SE 11, and later - Part of the standard Java API with a bundled implementation.
- Java 9 adds some minor features and fixes.
Java SE 6 and Java SE 7
- Most of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.
Android
- Later versions of Android bundle implementations of the java.time classes.
- For earlier Android (<26), the ThreeTenABP project adapts ThreeTen-Backport (mentioned above). See How to use ThreeTenABP….
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval
, YearWeek
, YearQuarter
, and more.
add a comment |
up vote
5
down vote
up vote
5
down vote
I am using java SimpleDateFormat
Don’t.
Avoid the treacherous old date-time classes bundled with the earliest versions of Java. They were supplanted years ago with the java.time classes when JSR 310 was adopted.
convert incoming long time value in microseconds into milliseconds
Don’t.
The java.time classes use a resolution of nanoseconds, finer than your microseconds. So no need to throw away data.
Instant
= ( whole seconds + fractional second as nanos )
Extract the number of whole seconds.
long seconds = TimeUnit.MICROSECONDS.toSeconds( micros ) ;
Get the fractional second, the amount of micros left over after subtracting for the whole seconds.
long microsRemaining =
micros
-
TimeUnit.SECONDS.toMicros( seconds )
;
Convert the remaining micros to nanos, because the Instant
class we use next represents a count of whole seconds plus a count of nanoseconds (for the fractional second).
long nanos = TimeUnit.MICROSECONDS.toNanos( microsRemaining ) ;
Combine the whole seconds with the fractional second in nanos. The Instant
class represents a moment in UTC as a count since the epoch reference of first moment of 1970 in UTC, 1970-01-01T00:00Z.
Instant instant = Instant.ofEpochSecond( seconds ).plusNanos( nanos ) ;
To generate a string in standard ISO 8601 format, simply call toString
.
String output = instant.toString() ;
The Z
on the end of the string means UTC (an offset-from-UTC of zero hours-minutes-seconds), and is pronounced Zulu
.
You can produce strings in your own custom formats using the DateTimeFormatter
class. Search Stack Overflow as this has been covered many many many times already.
Tip: Your desired format is so close to the ISO 8601 format, YYYY-MM-DDTHH:MM:SSZ, that I strongly suggest using the standard format rather than make up your own cousin of that.
If you wish to see this same moment through the lens of the wall-clock time used by people of a certain region (a time zone), apply a ZoneId
to get a ZonedDateTime
.
ZoneId z = ZoneId.of( "Africa/Tunisia" ) ;
ZonedDateTime zdt = instant.atZone( z ) ;
About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date
, Calendar
, & SimpleDateFormat
.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.*
classes.
Where to obtain the java.time classes?
Java SE 8, Java SE 9, Java SE 10, Java SE 11, and later - Part of the standard Java API with a bundled implementation.
- Java 9 adds some minor features and fixes.
Java SE 6 and Java SE 7
- Most of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.
Android
- Later versions of Android bundle implementations of the java.time classes.
- For earlier Android (<26), the ThreeTenABP project adapts ThreeTen-Backport (mentioned above). See How to use ThreeTenABP….
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval
, YearWeek
, YearQuarter
, and more.
I am using java SimpleDateFormat
Don’t.
Avoid the treacherous old date-time classes bundled with the earliest versions of Java. They were supplanted years ago with the java.time classes when JSR 310 was adopted.
convert incoming long time value in microseconds into milliseconds
Don’t.
The java.time classes use a resolution of nanoseconds, finer than your microseconds. So no need to throw away data.
Instant
= ( whole seconds + fractional second as nanos )
Extract the number of whole seconds.
long seconds = TimeUnit.MICROSECONDS.toSeconds( micros ) ;
Get the fractional second, the amount of micros left over after subtracting for the whole seconds.
long microsRemaining =
micros
-
TimeUnit.SECONDS.toMicros( seconds )
;
Convert the remaining micros to nanos, because the Instant
class we use next represents a count of whole seconds plus a count of nanoseconds (for the fractional second).
long nanos = TimeUnit.MICROSECONDS.toNanos( microsRemaining ) ;
Combine the whole seconds with the fractional second in nanos. The Instant
class represents a moment in UTC as a count since the epoch reference of first moment of 1970 in UTC, 1970-01-01T00:00Z.
Instant instant = Instant.ofEpochSecond( seconds ).plusNanos( nanos ) ;
To generate a string in standard ISO 8601 format, simply call toString
.
String output = instant.toString() ;
The Z
on the end of the string means UTC (an offset-from-UTC of zero hours-minutes-seconds), and is pronounced Zulu
.
You can produce strings in your own custom formats using the DateTimeFormatter
class. Search Stack Overflow as this has been covered many many many times already.
Tip: Your desired format is so close to the ISO 8601 format, YYYY-MM-DDTHH:MM:SSZ, that I strongly suggest using the standard format rather than make up your own cousin of that.
If you wish to see this same moment through the lens of the wall-clock time used by people of a certain region (a time zone), apply a ZoneId
to get a ZonedDateTime
.
ZoneId z = ZoneId.of( "Africa/Tunisia" ) ;
ZonedDateTime zdt = instant.atZone( z ) ;
About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date
, Calendar
, & SimpleDateFormat
.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
You may exchange java.time objects directly with your database. Use a JDBC driver compliant with JDBC 4.2 or later. No need for strings, no need for java.sql.*
classes.
Where to obtain the java.time classes?
Java SE 8, Java SE 9, Java SE 10, Java SE 11, and later - Part of the standard Java API with a bundled implementation.
- Java 9 adds some minor features and fixes.
Java SE 6 and Java SE 7
- Most of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.
Android
- Later versions of Android bundle implementations of the java.time classes.
- For earlier Android (<26), the ThreeTenABP project adapts ThreeTen-Backport (mentioned above). See How to use ThreeTenABP….
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval
, YearWeek
, YearQuarter
, and more.
edited Nov 5 at 4:57
answered Nov 5 at 4:48
Basil Bourque
101k24350506
101k24350506
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53148094%2fconvert-microseconds-to-milliseconds-without-loss-of-precision-and-format-as-dat%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
What's you current input value and what's your expected output value?
– MadProgrammer
Nov 5 at 3:56
What does you mean with "I am loosing the value"? Can you provide a runnable Minimal, Complete, and Verifiable example, with appropriate sampel values for the microseconds, that shows what you wanted to happen and what happened instead?
– Erwin Bolwidt
Nov 5 at 3:59
1
Convert microseconds string to date in Java or Scala might help
– MadProgrammer
Nov 5 at 4:00
1
You should include sample data, indicating given inputs and expected outputs.
– Basil Bourque
Nov 5 at 4:48
1
uh, you are getting microseconds and want milliseconds without loss of precision. You are aware that 1000 microseconds go into a single millisecond and you're treating the number of milliseconds as an integer value. You are ALWAYS going to lose precision.
– jwenting
Nov 5 at 9:51