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

    Join Date
    May 2000
    Posts
    33
    Rep Power
    15
    I am using a Microsoft access database to store entries for a photo album. The database has a separate cell with date of the pictures, in 01.12.99 format. I know that I can get around this issue by setting the field type to text instead of date, but I use the field for sorting. The PHP code displays the cell variable it pulls from the database ($Date) as 1999-12-01 00:00:00. I checked the internal PHP functions like Date, Mktime, etc, I don't think they handle this. Or am I wrong? Please help!
    Stas
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    A very easy soultion is that you should change the date format in msaccess.
    Go to design view and select the date format you want.
    Other wise you will have to use mktime() funtion in Php for date formatting.


    ------------------
    SR -
    shiju.dreamcenter.net

    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    33
    Rep Power
    15
    Thanks for the advice, Shiju! I tried, but with no success - PHP seems to process the date in its own format independent of the format specified in the database. It still displays everything as 1999-12-01 00:00:00, though the date is in the short format in Ms Access (01.12.99). I asked on phpbuilder and they advised using:
    eregi_replace("([0-9]{2})([0-9]{2})-([0-9]{2})-([0-9]{2})(.*)", "4.3.2", $Date);
    How do I do this with mktime()? I doubt if eregi_replace() is a faster function.
    Thanks in advance,
    Stas

Similar Threads

  1. Database Administrators
    By phil310 in forum Database Management
    Replies: 1
    Last Post: February 9th, 2004, 02:03 PM
  2. time in - time out
    By newbiex in forum PHP Development
    Replies: 2
    Last Post: February 9th, 2004, 03:04 AM
  3. Replies: 1
    Last Post: January 28th, 2004, 12:35 AM

IMN logo majestic logo threadwatch logo seochat tools logo