Support Forums

Date problems

This is a discussion on Date problems within the Customizations forums, part of the Developer Forums category; What version of 68 Classifieds are you running? Example: V4.1.6 Designer What template are you using? default Please describe in ...


Go Back   68 Classifieds Forums > Developer Forums > Customizations

Reply
 
Thread Tools Display Modes
Old 12-01-2009, 12:46 PM   #1
Senior Member
 
Join Date: Dec 2006
Posts: 104
Rep Power: 22
objelland is on a distinguished road
Default Date problems

What version of 68 Classifieds are you running?
Example: V4.1.6 Designer

What template are you using?
default

Please describe in detail the issue you are having:
Hi all,
I am trying to pull the expiration date out of the class_producst table like this:
Code:
$sSQL= "SELECT expiration FROM ".PREFIX."products WHERE section = '4704' and id = ".$userid." LIMIT 1";
$result=$db->query($sSQL);
$rs=$result->fetch();
$origDate = explode("-", $rs['expiration']);
$expiration= mktime(0,0,0,$origDate[1],$origDate[2],$origDate[0]);
$expiration = strftime("%Y-%m-%d",$expiration);
Then I am assignng the result to the template like this:

Code:
$class_tpl->assign('expiration',$expiration);
My problem is, "no matter what I do" the result of the query returns "1970-01-01".
I know this is the start of the Unix time age, but how can I get this solved? There is probably some function or convert string that I am not aware of. Can somebody please help me out with this?

Thank you!

Regards ,
Oyvind
__________________
objelland
V3.1.5b Developer
objelland is offline   Reply With Quote
Old 12-01-2009, 12:54 PM   #2
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,489
Rep Power: 135
Eric Barnes is just really nice Eric Barnes is just really nice
Default

I would just pull it out as it is stored and then use smarty date format to change it:
Smarty

Code:
{$expiration|date_format:"%A, %B %e, %Y"}
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 12-01-2009, 01:16 PM   #3
Senior Member
 
Join Date: Dec 2006
Posts: 104
Rep Power: 22
objelland is on a distinguished road
Default

Quote:
Originally Posted by Eric Barnes
I would just pull it out as it is stored and then use smarty date format to change it:
Smarty

Code:
{$expiration|date_format:"%A, %B %e, %Y"}
Hi,

My problem is not the display of the data, but the result of the query. The expiration field in the class_products table contains the value "2009-12-12", but the SQL Query returns "1970-01-01"...

Regardsm

Oyvind
__________________
objelland
V3.1.5b Developer
objelland is offline   Reply With Quote
Old 12-01-2009, 01:23 PM   #4
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by objelland
Hi,

My problem is not the display of the data, but the result of the query. The expiration field in the class_products table contains the value "2009-12-12", but the SQL Query returns "1970-01-01"...

Regardsm

Oyvind
How did you determine that?
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 12-01-2009, 01:27 PM   #5
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

actually, looking at your query a bit closer I see why, the products table doesnt have a field called expiration.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 12-01-2009, 01:58 PM   #6
Senior Member
 
Join Date: Dec 2006
Posts: 104
Rep Power: 22
objelland is on a distinguished road
Default

Quote:
Originally Posted by Lhotch
actually, looking at your query a bit closer I see why, the products table doesnt have a field called expiration.
Well, I am running a version that has that field in the producst table. I know my version isn't supportet (developer 3.1.5b), but I was still hoping for some help here

Thanks,

Oyvind
__________________
objelland
V3.1.5b Developer
objelland is offline   Reply With Quote
Old 12-01-2009, 02:07 PM   #7
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by objelland
Well, I am running a version that has that field in the producst table. I know my version isn't supportet (developer 3.1.5b), but I was still hoping for some help here

Thanks,

Oyvind
In your first post you have version 4.1.6, now your saying your running 3.1.5.

Not giving us these sort of details up front means you contribute to people possibly spending time trying to help you by looking at info that isnt even relevant and in turn wastes their time. That lack of respect for other peoples time certainly isnt going to make people help you.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 12-01-2009, 02:18 PM   #8
Senior Member
 
Join Date: Dec 2006
Posts: 104
Rep Power: 22
objelland is on a distinguished road
Default

Quote:
Originally Posted by Lhotch
In your first post you have version 4.1.6, now your saying your running 3.1.5.

Not giving us these sort of details up front means you contribute to people possibly spending time trying to help you by looking at info that isnt even relevant and in turn wastes their time. That lack of respect for other peoples time certainly isnt going to make people help you.
I can see that you are getting upset with me waisting your precious time. I have just one question for you "WHAT HAPPEND TO ALLOWING PEOPLE TO MAKE MISTAKES???? "
You are probarbly using this forum every singel day, at least it looks like it based on the number of threads you have posted. Could it be possible that other people aren't as into the forum rules as you are?? Just a question from me to you..... Could it be possible that I over looked the version 4.1.6 part because it is default in when posting a new thread?

Oyvind
__________________
objelland
V3.1.5b Developer
objelland is offline   Reply With Quote
Old 12-01-2009, 02:31 PM   #9
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by objelland
"WHAT HAPPEND TO ALLOWING PEOPLE TO MAKE MISTAKES???? "
I make mistakes all the time.....like posting in this thread.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 12-01-2009, 07:47 PM   #10
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,489
Rep Power: 135
Eric Barnes is just really nice Eric Barnes is just really nice
Default

Look in the database and double check that the date value is actually something other than the really old one.

Next try to just echo it without having it run through this code:
Code:
$origDate = explode("-", $rs['expiration']);
$expiration= mktime(0,0,0,$origDate[1],$origDate[2],$origDate[0]);
$expiration = strftime("%Y-%m-%d",$expiration);
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Renewal = Date Added pipelin Technical Support 10 10-29-2009 11:18 AM
PM Date wabugi Technical Support 14 04-21-2009 04:36 PM
Date Added and Expiration Date suav Technical Support 2 09-10-2008 12:48 AM
Expiration Date goose Technical Support 2 01-01-2008 02:27 PM


All times are GMT -4. The time now is 10:03 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0