Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 10-31-2008, 08:34 PM php scipt date help
Experienced Talker

Latest Blog Post:
Add A AlertPay Donate Button
Posts: 32
Location: EZmuney.net
Trades: 0
I am using a php script that uses mysql to store the data, when users register the dates do not show correctly, they just show as number for example "1225440861", how and where can I translate this to just the month and year?
__________________

Please login or register to view this content. Registration is FREE
MuneyMan is offline
Reply With Quote
View Public Profile Visit MuneyMan's homepage!
 
 
Register now for full access!
Old 10-31-2008, 08:37 PM Re: php scipt date help
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.php.net/date
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-31-2008, 09:27 PM Re: php scipt date help
Experienced Talker

Latest Blog Post:
Add A AlertPay Donate Button
Posts: 32
Location: EZmuney.net
Trades: 0
I don't clearly see where to implement this code?
__________________

Please login or register to view this content. Registration is FREE
MuneyMan is offline
Reply With Quote
View Public Profile Visit MuneyMan's homepage!
 
Old 10-31-2008, 09:37 PM Re: php scipt date help
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
from a little bit down the page.
Quote:
$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm
$today = date("m.d.y"); // 03.10.01
$today = date("j, n, Y"); // 10, 3, 2001
$today = date("Ymd"); // 20010310
$today = date('h-i-s, j-m-y, it is w Day z '); // 05-16-17, 10-03-01, 1631 1618 6 Fripm01
$today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // It is the 10th day.
$today = date("D M j G:i:s T Y"); // Sat Mar 10 15:16:08 MST 2001
$today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:17 m is month
$today = date("H:i:s"); // 17:16:17
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-31-2008, 09:52 PM Re: php scipt date help
Experienced Talker

Latest Blog Post:
Add A AlertPay Donate Button
Posts: 32
Location: EZmuney.net
Trades: 0
I take it this goes in the functions.php file so dates site wide are shown correctly?

Or in the database?
__________________

Please login or register to view this content. Registration is FREE
MuneyMan is offline
Reply With Quote
View Public Profile Visit MuneyMan's homepage!
 
Old 11-01-2008, 08:52 AM Re: php scipt date help
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You use the formatting wherever you need to display a date on the page.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-01-2008, 08:56 AM Re: php scipt date help
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
That field is of type timestamp, not date. Check you db. you need to convert it to date format from timestamp while showing.
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Old 11-02-2008, 08:31 PM Re: php scipt date help
Skilled Talker

Posts: 52
Name: Morten
Trades: 0
$date = date("d/m-Y H:i:s"); / 01/11-2008 02:20:42

This should cover the most
__________________
- Do Nothing!
- Get Nothing!

Please login or register to view this content. Registration is FREE
Rotco88 is offline
Reply With Quote
View Public Profile
 
Old 11-05-2008, 09:18 PM Re: php scipt date help
Experienced Talker

Latest Blog Post:
Add A AlertPay Donate Button
Posts: 32
Location: EZmuney.net
Trades: 0
`joindate` varchar(150) NOT NULL,
`lastlogdate` varchar(150) NOT NULL,

thats all i can find in referrence to date in the database.
__________________

Please login or register to view this content. Registration is FREE
MuneyMan is offline
Reply With Quote
View Public Profile Visit MuneyMan's homepage!
 
Old 11-05-2008, 09:44 PM Re: php scipt date help
Experienced Talker

Latest Blog Post:
Add A AlertPay Donate Button
Posts: 32
Location: EZmuney.net
Trades: 0
Quote:
Originally Posted by chrishirst View Post
from a little bit down the page.
ok if i just use this method and on any page I need a date on, where would it go? before? after? does it need some extra code?

<?= $registroe["joindate"] ?> is the output for the date code in one instance.
__________________

Please login or register to view this content. Registration is FREE
MuneyMan is offline
Reply With Quote
View Public Profile Visit MuneyMan's homepage!
 
Old 11-06-2008, 12:08 AM Re: php scipt date help
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Quote:
Originally Posted by MuneyMan View Post
`joindate` varchar(150) NOT NULL,
`lastlogdate` varchar(150) NOT NULL,

thats all i can find in referrence to date in the database.
Why varchar? Change them first to timestamp and then to datetime (I'm afraid that you can lose your data if changed from varchar to datetime directly).
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 11-06-2008, 02:36 AM Re: php scipt date help
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
i don't think you need to change the field type now. You can store the the timestamp in varchar field also, and i think you current script is doing that. For testing,

your timestamp in the first post:

$time_stmp = 1225440861;
echo date('Y-m-d',$time_stmp);
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Old 11-06-2008, 02:44 AM Re: php scipt date help
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
I wonder why did all these guys who spend years to develop freeware database engine decided to include separate data types for numbers, strings and dates if they could simply store EVERYTHING as varchar?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 11-06-2008, 07:34 PM Re: php scipt date help
Experienced Talker

Latest Blog Post:
Add A AlertPay Donate Button
Posts: 32
Location: EZmuney.net
Trades: 0
where would I implement that?

thanks for all the help guys btw
__________________

Please login or register to view this content. Registration is FREE
MuneyMan is offline
Reply With Quote
View Public Profile Visit MuneyMan's homepage!
 
Old 11-06-2008, 09:23 PM Re: php scipt date help
Experienced Talker

Latest Blog Post:
Add A AlertPay Donate Button
Posts: 32
Location: EZmuney.net
Trades: 0
the timing code on the register page is set as this line of code and nothing else

$joindate=time();

that handles the code, I know joindate is the field in the users profile in the db as well as on the site. the =time(); is where the time is being handled, this is what needs to be changed I take it?
__________________

Please login or register to view this content. Registration is FREE
MuneyMan is offline
Reply With Quote
View Public Profile Visit MuneyMan's homepage!
 
Old 11-07-2008, 02:24 AM Re: php scipt date help
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
Nothing to wonder Mike, The database is already designed, and i don't think it will be possible for this guy to change the data type without losing data. That's my understanding. I am not here to prove how much i know, and how less the others.

MuneyMan please spend some time with PHP before you can start working.

Regards.
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE

Last edited by jito; 11-07-2008 at 02:25 AM..
jito is offline
Reply With Quote
View Public Profile
 
Old 11-07-2008, 03:22 AM Re: php scipt date help
Experienced Talker

Latest Blog Post:
Add A AlertPay Donate Button
Posts: 32
Location: EZmuney.net
Trades: 0
I have spent plenty of time with php just most on forum related mods and programming, I got everything else going with the software just stuck on the whole date thing.

Never seen this in a script
__________________

Please login or register to view this content. Registration is FREE

Last edited by MuneyMan; 11-07-2008 at 03:34 AM..
MuneyMan is offline
Reply With Quote
View Public Profile Visit MuneyMan's homepage!
 
Old 11-07-2008, 12:52 PM Re: php scipt date help
Experienced Talker

Latest Blog Post:
Add A AlertPay Donate Button
Posts: 32
Location: EZmuney.net
Trades: 0
The date works fine everywhere else in the script just for some reason, the date added to a users profile when registering is what shows up as a line of numbers.

I have even tried swapping $joindate=time(); to $joindate=date();

That gives me this error upon registering: Warning: date() expects at least 1 parameter, 0 given
__________________

Please login or register to view this content. Registration is FREE
MuneyMan is offline
Reply With Quote
View Public Profile Visit MuneyMan's homepage!
 
Old 11-10-2008, 01:32 AM Re: php scipt date help
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
$joindate=date('Y-m-d,h:i:s'); you want the output something like that.
__________________
I am not smart, that's why i don't act smart


Please login or register to view this content. Registration is FREE
jito is offline
Reply With Quote
View Public Profile
 
Old 11-10-2008, 01:50 PM Re: php scipt date help
Experienced Talker

Latest Blog Post:
Add A AlertPay Donate Button
Posts: 32
Location: EZmuney.net
Trades: 0
I got it working this morning!
Was simple don't know how I was missing it.

Thanks for the replies!
__________________

Please login or register to view this content. Registration is FREE
MuneyMan is offline
Reply With Quote
View Public Profile Visit MuneyMan's homepage!
 
Reply     « Reply to php scipt date help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.65453 seconds with 12 queries