SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Unix Epoc

Hybrid View

  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Unix Epoc

    Is the time at the Unix Epoch equal to zero (0) ??


    Debbie

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    https://en.wikipedia.org/wiki/Unix_time
    The Unix time number is zero at the Unix epoch, and increases by exactly 86 400 per day since the epoch.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by logic_earth View Post
    How would I represent the Unix Epoch in the DateTime format?


    Debbie

  4. #4
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Whose DateTime format?

    Code:
    date(DATE_ISO8601, 0)
    Code:
    1970-01-01T00:00:00+0000
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  5. #5
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,756
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AnthonySterling View Post
    Whose DateTime format?

    Code:
    date(DATE_ISO8601, 0)
    I meant DateTime format in MySQL.

    So, if I wanted to store the Unix Epoch in a MySQL DateTIme field what would I enter?

    Thanks,


    Debbie
    Code:
    1970-01-01T00:00:00+0000

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,215
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by DoubleDee View Post
    So, if I wanted to store the Unix Epoch in a MySQL DateTIme field what would I enter?
    you would first need to decide whether you wanted your mysql table to store an actual datetime value, in which case your choices for datatype are DATETIME and TIMESTAMP, or whether you wanted to store the actual unix epoch number, in which case your choice is limited to INTEGER
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •