B4J Question datetime from mysql

Discussion in 'B4J Questions' started by TomDuncan, Jan 29, 2018.

Tags:
  1. TomDuncan

    TomDuncan Active Member Licensed User

    Hi All,
    I have a field in a mysql table which gives the result like "1517191800"
    How can I display this as the correct time. (Around 1pm on 29th Jan 2018)
    Timezone is +11 hrs (10 + daylightsaving) (Hobart, Australia)
    Tom
     
    Last edited: Jan 29, 2018
  2. Roycefer

    Roycefer Well-Known Member Licensed User

    In B4J:
    Code:
    Dim t As Long = YourVal  'YourVal is the result from the table
    Log($"$DateTime{t*1000}"$)
    In SQL, you can use the DATETIME method:
    Code:
    SELECT DATETIME(fieldname, 'unixepoch','localtime') FROM tablename WHERE blah blah blah
     
    TomDuncan likes this.
  3. TomDuncan

    TomDuncan Active Member Licensed User

    Thanks for that works like a charm
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice