Jump to content

Recommended Posts

I am trying to get login_time equal to stroftime row login_time please help thank you.


This will print what time is in the database but i need to add stroftime also how thank you.
[code]
$login_time =$row["login_time"];
[/code]


I tried this way any other way at the same time print the time from the database with the stroftime added thank you.
[code]
$login_time =(stroftime($row["login_time"]));
[/code]
Link to comment
https://forums.phpfreaks.com/topic/5351-help-code-thank-you/
Share on other sites

I'm not exactly sure what you're asking, as your english isn't that great, but if you want to get a formatted string from the database, you have to use the date() function with a time/date format:

[code]$login_time = date("n/j/Y h:i:s A", strtotime($row["login_time"])); [/code]
Link to comment
https://forums.phpfreaks.com/topic/5351-help-code-thank-you/#findComment-19048
Share on other sites

why this wrong please thank you.
[code]

$now = strtotime(date("n/j/Y h:i:s A");

$login_time = date("n/j/Y h:i:s A", strtotime($row["login_time"]));

$logout_time = date("n/j/Y h:i:s A", strtotime($row["logout_time"]));

if($login_time > $logout_time && $now < $logout_time){

echo "It is ".date('n/j/Y h:i:s A',$now)." the Market is now open!<br>";

$still_open =($logout_time - $now)/3600;

$still_open = number_format($still_open,2);

echo "It will close in $still_open hours.";

}
elseif($now < $login_time ||$now > $logout_time){

echo "The Market is now closed!<br>";

$until_open =($login_time - $now)+75600;

$until_open = number_format($until_open/3600,2);

echo "It will reopen in $until_open hours";
}

[/code]
Link to comment
https://forums.phpfreaks.com/topic/5351-help-code-thank-you/#findComment-19056
Share on other sites



how can i get the hour min sec from the date of login and logout in min hour day

[code]

$minute = date('n/j/Y :i A');
    $hour = date('n/j/Y h:i:s A');
    $day = $hour * date('n/j/Y h:i:s A');

$login_time = date('n/j/Y h:i:s A', strtotime($row['login_time']));

$logout_time = date('n/j/Y h:i:s A', strtotime($row['logout_time']));

[/code]
Link to comment
https://forums.phpfreaks.com/topic/5351-help-code-thank-you/#findComment-19058
Share on other sites

maybe you can not get the diffrence of the date and time when its put in the database to out put a result

can not get the result of date to give me the remaing result from the database that holds the date and tim please help.

[code]

//change user and password to your mySQL name and password
mysql_connect("xxx","xxx","xxx");

//select which database you want to edit
mysql_select_db("jojo");




//If cmd has not been initialized
if(!isset($tmp))



{
  //display all the news
$tmp=mysql_query("SELECT * FROM log");
while ($row = mysql_fetch_assoc($tmp))
  {
     //grab the title and the ID of the news




$logout_time=$row['logout_time'];//take out the id

$login_time=$row['login_time'];//take out the id



$minute = 60;
    $hour = 60 * 60;
    $day = $hour * 24;


$login_time = date('n/j/Y h:i:s A', strtotime($row['login_time']));

$logout_time = date('n/j/Y h:i:s A', strtotime($row['logout_time']));

echo"<br>";

echo $logout_time;

echo"<br>";

echo $login_time;

echo"<br>";

    $seconds_left = $logout_time - $login_time;

echo $seconds_left;

    $days_left = floor($seconds_left / $day);


echo $days_left;

    $hours_left = floor(($seconds_left % $day)/$hour);

    $minutes_left = floor((($seconds_left % $day) % $hour) / $minute);



    echo 'Start: ' . date('n/j/Y h:i:s A',$login_time) . "<br />\n";
    echo 'End: ' . date('n/j/Y h:i:s A',$logout_time) . "<br />\n";
    echo 'There are ' . $days_left . ' days, ' . $hours_left . ' hours and ' .
$minutes_left . ' minutes left';
}
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/5351-help-code-thank-you/#findComment-19072
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.