Convert 'MMDDYYYY' in database

Discussion in 'MySQL' started by unlisted80, Oct 4, 2006.

  1. #1
    I try to find out how "1151958691" = to October 2, 2005 what kind conversion do they use?


    Thanks
     
    unlisted80, Oct 4, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    mad4, Oct 4, 2006 IP
  3. jeremyweber

    jeremyweber Peon

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I prefer to keep dates as ints or longs in the database. It makes comparisons easier and for me is more maintainable. The conversion depends on the language you are using.
     
    jeremyweber, Oct 4, 2006 IP
  4. falcondriver

    falcondriver Well-Known Member

    Messages:
    963
    Likes Received:
    47
    Best Answers:
    0
    Trophy Points:
    145
    #4
    falcondriver, Oct 4, 2006 IP
  5. unlisted80

    unlisted80 Peon

    Messages:
    644
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i try to find out what kind conversion is that...also they are using php language :)

    any ideals?
     
    unlisted80, Oct 4, 2006 IP
  6. rosytoes

    rosytoes Peon

    Messages:
    230
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    it's a unix timestamp isnt it?
     
    rosytoes, Oct 4, 2006 IP
  7. falcondriver

    falcondriver Well-Known Member

    Messages:
    963
    Likes Received:
    47
    Best Answers:
    0
    Trophy Points:
    145
    #7
    not sure what it is, but this:
    
    $test=1151958691;
    echo date("r", $test);
    
    Code (markup):
    returns "Mon, 03 Jul 2006 22:31:31 +0200". is this close enought to October 2, 2005 for your needs? :)
    if you dont have a typo in your number then you must provide the function who created this number to build a invert function.
     
    falcondriver, Oct 4, 2006 IP
  8. intoex

    intoex Peon

    Messages:
    414
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Maybe time stamp +- some value? Explore other values
    
    FROM_UNIXTIME(unix_timestamp,format) 
    Returns a string representation of the Unix timestamp, formatted according to the format string. format may contain the same specifiers as those listed in the entry for the DATE_FORMAT() function: 
    mysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),
                                '%Y %D %M %h:%i:%s %x');
            -> '1997 23rd December 03:43:30 1997'
    
    Code (markup):
     
    intoex, Oct 7, 2006 IP