PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 30th, 2000, 02:00 AM
okhvatstas okhvatstas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 33 okhvatstas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
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

Reply With Quote
  #2  
Old May 30th, 2000, 05:47 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan

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..."

Reply With Quote
  #3  
Old May 30th, 2000, 09:48 PM
okhvatstas okhvatstas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 33 okhvatstas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Correct time display of time taken from database cell

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap