Jump to content

Recommended Posts

Linux time is just a count in seconds from Jan 1 1970

 

one day is 86400 seconds...

so from there you can just find the difference between the current UNIX timestamp and the timestamp you have in your db

 

if it's less than 86400...it was today

if it's less than 172800 but greater than 86400 then it's yesterday

Link to comment
https://forums.phpfreaks.com/topic/108772-determine-today/#findComment-557997
Share on other sites

Linux time is just a count in seconds from Jan 1 1970

 

one day is 86400 seconds...

so from there you can just find the difference between the current UNIX timestamp and the timestamp you have in your db

 

if it's less than 86400...it was today

if it's less than 172800 but greater than 86400 then it's yesterday

 

elseif ( (time() - int($row['time'])) < 172800 && (time() - int($row['time'])) > 86400 )

 

is it <= or just < ??

Link to comment
https://forums.phpfreaks.com/topic/108772-determine-today/#findComment-558041
Share on other sites

I think you can just do the following...

 

Pull the info from your database..

  $Transaction_Info = array('Check_Number'=>mysql_result($result, $i, "Check_Num"),

  'Pay_To'=>mysql_result($result, $i, 'Pay_To'),

'Date'=>mysql_result($result, $i, "Date"),

'Transaction_Type'=>mysql_result($result, $i, "Transaction_Type"),

'Amount'=>mysql_result($result, $i, "Amount"),

'Comments'=>mysql_result($result, $i, "Comments"));

 

 

Now just display it

 

echo date("m/d/Y", time($Transaction_Info['Date']))

 

I pulled this from a project i was working on a while back all you really need to worry about is

 

'Date'=>mysql_result($result, $i, "Date"),

 

this is just putting the timestamp form the database into an array

 

then you can just echo it.

 

Hope this helps.

Link to comment
https://forums.phpfreaks.com/topic/108772-determine-today/#findComment-558084
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.