Jump to content

Date help

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
Whitey

Whitey

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
Okay i want to make a function that shows how many days you've been in the clan..

Well i want it to be something like
$datejoined = date("z", somethinghere);
$currentdate = date('z')

then go
echo("Days in clan: ");
echo($currentdate - $datejoined);

But i cant seem to setup the datejoined variable.. i have something like this.
Functions
function date_from_timestamp_from_mysql($col, $table){

	$sql_viewlogs = 'Select UNIX_TIMESTAMP(' . $col . ') as ' . $col . '

                     from ' . $table . ';';

	$view = mysql_query($sql_viewlogs);

  	$array_date = mysql_fetch_array($view);

	$date = date("M j Y",$array_date['' . $col . '']);

    return $date;


and

date_from_timestamp_from_mysql(joined, users)

Shows the date they joined.. But i cant put date("z", "date_from_timestamp_from_mysql(joined, users)"); i get an error for it being to long or something.. SO any help?

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
What is the exact error you get?

#3
Whitey

Whitey

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 255 posts
date() expects parameter 2 to be long, string given in C:\wamp\www\LoginScript\Old_Test\userinfo.php on line 50


But really if any of you guys have aim and/or msn i would rather talk on their.. Gets my questions answered quicker and better to explain back and fourth.

#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts

Whitey said:

date() expects parameter 2 to be long, string given in C:\wamp\www\LoginScript\Old_Test\userinfo.php on line 50
The second parameter is a unix time stamp. So when they join, you should add their join date to their table row in the database as a timestamp [Number of seconds since the beginning of the Unix Epoch]

Whitey said:

But really if any of you guys have aim and/or msn i would rather talk on their.. Gets my questions answered quicker and better to explain back and fourth.

Yes we both have aim and msn, but we will probably ignore you. The purpose of the forum is to help you, and help people who will have the same error in the future. If we tell you how to fix your problem in private, it isn't helping anyone else.