TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 06-06-2009, 06:11 PM   #1 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default peculiar date issue

Hey guys I have an interesting date issue.

I'm trying to store birthdays. The MYSQL column is set as INT(10) and the name of the column is bday.

I have 3 dropdowns: month, day, year.

I check that all the info is correct before I convert the data into timestamp for the database table.

PHP Code:
$bday  mktime(000$u_month$u_day$u_year); 
$bday is now in timestamp format.

So if my bday is: June 10 1990 it goes in as: 6, 10, 1990 respectively.

When I log off my site and come back, it seems to pull the data out with one day off, but the rest of the data is correct.

So I would get: 6 9 1990.

Here's the code when I pull it out of the DB:

PHP Code:
// MYSQL QUERY SNIPPET

$g_bday    $row["bday"];
$g_month date("n",$g_bday);
$g_day    date("j",$g_bday);
$g_year    date("Y",$g_bday); 

This gives me again: 6 9 1990


It is just sooo very weird that the day is always one off.

But everything else, MONTH or YEAR goes in and out perfectly.

If I change the day to 25, then I get back 24...

Do you guys have any idea why it does this?

I kept the code pretty short because I think most of you could figure out what I'm doing, and I don't beleive there's much more that I really need to show you but if you need any more code, let me know...
allworknoplay is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Font color for key based on modif date ? Peuplarchie General 1 04-14-2009 01:37 PM
Frustrating PNG Issue on IE 6 aristoworks XHTML, HTML, CSS 5 11-10-2008 08:18 AM
help me figure out this date thing sarmenhb Absolute Beginners 5 09-15-2008 04:20 PM
Need more ideas for date and time class Wildhoney General 2 01-18-2008 02:22 PM
converting to mysql date format harryhood Absolute Beginners 1 08-21-2005 03:57 AM


All times are GMT. The time now is 06:52 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design