You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by spr <sp...@yarcdata.com> on 2014/11/13 17:47:55 UTC

how to convert System.currentTimeMillis to calendar time

Apologies for what seems an egregiously simple question, but I can't find the
answer anywhere.  

I have timestamps from the Spark Streaming Time() interface, in milliseconds
since an epoch, and I want to print out a human-readable calendar date and
time.  How does one do that?  



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/how-to-convert-System-currentTimeMillis-to-calendar-time-tp18856.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Re: how to convert System.currentTimeMillis to calendar time

Posted by Jimmy McErlain <ji...@sellpoints.com>.
You could also use the jodatime library, which has a ton of great other
options in it.
J
ᐧ




*JIMMY MCERLAIN*

DATA SCIENTIST (NERD)

*. . . . . . . . . . . . . . . . . .*


*IF WE CAN’T DOUBLE YOUR SALES,*



*ONE OF US IS IN THE WRONG BUSINESS.*

*E*: jimmy@sellpoints.com

*M*: *510.303.7751*

On Thu, Nov 13, 2014 at 10:40 AM, Akhil Das <ak...@sigmoidanalytics.com>
wrote:

> This way?
>
> scala> val epoch = System.currentTimeMillis
> epoch: Long = 1415903974545
>
> scala> val date = new Date(epoch)
> date: java.util.Date = Fri Nov 14 00:09:34 IST 2014
>
>
>
> Thanks
> Best Regards
>
> On Thu, Nov 13, 2014 at 10:17 PM, spr <sp...@yarcdata.com> wrote:
>
>> Apologies for what seems an egregiously simple question, but I can't find
>> the
>> answer anywhere.
>>
>> I have timestamps from the Spark Streaming Time() interface, in
>> milliseconds
>> since an epoch, and I want to print out a human-readable calendar date and
>> time.  How does one do that?
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-spark-user-list.1001560.n3.nabble.com/how-to-convert-System-currentTimeMillis-to-calendar-time-tp18856.html
>> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
>> For additional commands, e-mail: user-help@spark.apache.org
>>
>>
>

Re: how to convert System.currentTimeMillis to calendar time

Posted by Akhil Das <ak...@sigmoidanalytics.com>.
This way?

scala> val epoch = System.currentTimeMillis
epoch: Long = 1415903974545

scala> val date = new Date(epoch)
date: java.util.Date = Fri Nov 14 00:09:34 IST 2014



Thanks
Best Regards

On Thu, Nov 13, 2014 at 10:17 PM, spr <sp...@yarcdata.com> wrote:

> Apologies for what seems an egregiously simple question, but I can't find
> the
> answer anywhere.
>
> I have timestamps from the Spark Streaming Time() interface, in
> milliseconds
> since an epoch, and I want to print out a human-readable calendar date and
> time.  How does one do that?
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/how-to-convert-System-currentTimeMillis-to-calendar-time-tp18856.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>