Re: Converting a date to milliseconds with time zone in Scala Eclipse IDE

2020-04-29 Thread Som Lima
Also you may be surprised to learn that I started programming in scala just yesterday. I was really please I had a challenge to solve rather than copying example programmes which can be boring. Judging from answers received I think some may find this information useful. I used a scala specific

Re: Converting a date to milliseconds with time zone in Scala with fixed date str

2020-04-28 Thread Som Lima
import java.time._ import java.util.Date import java.text.SimpleDateFormat import java.util.Locale import java.util.SimpleTimeZone import org.joda.time import org.joda.time.DateTime object CalendarDemo extends App { println("Calendar Demo") val pattern = "E dd M

Re: Converting a date to milliseconds with time zone in Scala

2020-04-28 Thread Mich Talebzadeh
Hi, Thank you all, I am just thinking of passing that date 06/04/2020 12:03:43 and getting the correct format from the module. In effect This date format -MM-dd'T'HH:mm:ss.SZ as pattern in other words rather than new Date() pass "06/04/2020 12:03:43" as string REgards, Dr

Re: Converting a date to milliseconds with time zone in Scala

2020-04-28 Thread Som Lima
import java.time._ import java.util.Date import java.text.SimpleDateFormat import java.util.Locale import java.util.SimpleTimeZone object CalendarDemo extends App { println("Calendar Demo") val pattern = "E dd M HH:mm:ss.SSSZ"; val simpleDateFormat = (new

Re: Converting a date to milliseconds with time zone in Scala

2020-04-28 Thread Som Lima
import java.time._ import java.util.Date import java.text.SimpleDateFormat import java.util.Locale import java.util.SimpleTimeZone object CalendarDemo extends App { println("Calendar Demo") val pattern =3D "E dd M HH:mm:ss.SSSZ"; val simpleDateFormat =3D (new

Re: Converting a date to milliseconds with time zone in Scala

2020-04-28 Thread Edgardo Szrajber
Hiplease check combining unix_timestamp and from_unixtime, Something like:  from_unixtime(unix_timestamp( "06-04-2020 12:03:43"),"-MM-dd'T'HH:mm:ss Z") please note that I just wrote without any validation. In any case, you might want to check the documentation of both functions to check all

Re: Converting a date to milliseconds with time zone in Scala

2020-04-28 Thread Mich Talebzadeh
Unfortunately that did not work. any other suggestions? thanks Dr Mich Talebzadeh LinkedIn * https://www.linkedin.com/profile/view?id=AAEWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw *

Re: Converting a date to milliseconds with time zone in Scala

2020-04-28 Thread Mich Talebzadeh
Thanks Neeraj, I'll check it out. ! Dr Mich Talebzadeh LinkedIn * https://www.linkedin.com/profile/view?id=AAEWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw * http://talebzadehmich.wordpress.com *Disclaimer:* Use it

Re: Converting a date to milliseconds with time zone in Scala

2020-04-28 Thread neeraj bhadani
Hi Mich, You can try Spark DateTime function here and see if that helps. https://medium.com/expedia-group-tech/deep-dive-into-apache-spark-datetime-functions-b66de737950a Regards, Neeraj On Tue, Apr 28, 2020 at 5:15 PM Mich Talebzadeh wrote: > Hi, > > I have a date in format like