Thread: Exact date

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Posts
    75
    Rep Power
    1

    Exact date


    If using int in sql for time, what is the proper code to define exact date? lets say 15.nov.2017 ?
    Want to put a check for some articles but need exact date, not older 1 day, 2 days and so on...
  2. #2
  3. Maddening Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,453
    Rep Power
    9645
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,367
    Rep Power
    630
    Sounds like you are using the wrong data type. You will need to modify your schema.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2016
    Location
    Lakewood, WA
    Posts
    219
    Rep Power
    17
    Originally Posted by gw1500se
    Sounds like you are using the wrong data type. You will need to modify your schema.
    You could use int if the date/time was in Unix Epoc notation...

    I mean, you *could* convert 12 Aug 2017 at 1635 to 120820171635, but why not just store the standard date/time in the correct data type (In MySQL, "YYYY-MM-DD HH:MM:SS" => DATETIME) or Unix time in an int data type...

    SOOOOO much easier to manipulate date/time when you use the standard formats. I understand this is a database question, but pulling the data out and into the code, the datetime object is a wonderful thing.
    Last edited by Arty Zifferelli; November 15th, 2017 at 03:45 PM.

IMN logo majestic logo threadwatch logo seochat tools logo