Jump to content

fetch the date from timestamp


mrjameer

Recommended Posts

hi,

 

 

i have a mysql table with 3 fields

 

1.id  2.time 3.approved

 

values

 

1  1181237691  0

2  1181237703  0

3  1181237711  0

 

i want to fetch the distinct dates from this timestamp values using select statement.

i want to display like this

1  2007-06-07

 

 

second thing i want to update the approved value=1 where these distinct dates are equal to the above timestamps

 

any of your help will be surely appreciated.

thanks

mrjameer

Link to comment
Share on other sites

www.php.net/date

www.php.net/strtotime

 

$date = date('Y-m-d', $timefromdb);
$dateto = "2007-06-07";
$datetocheck = strtotime($dateto);

$sql = "UPDATE table_name SET value = 1 WHERE time = " . $datetocheck;

 

 

 

Link to comment
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.