Jump to content

Recommended Posts

if you create these date records yourself you should store em as UNIX Timestamps Here is a link to a short info site refering to this handy timestamp.

http://www.tizag.com/phpT/phpdate.php

 

If you dont create these timestamp you could chop it with the following function.

<?php

$datestring // lets say this is the variable holding the date like "2007-06-16 14:02:49".
$time = substr($datestring, 11, ; // this will output the part of string starting from character 11 and counting 8 character long (14:02:49) part off the string


$time // this contains "14:02:49"
?>

 

Hope this helps you

Link to comment
https://forums.phpfreaks.com/topic/55865-chop-sting/#findComment-275995
Share on other sites

You would use a combinatin of strtotime() and date().

 

date() allows you to format a date and/or time in any manner you wish. But it requires a timestamp. strtotime() converts a database date/time to a timestamp:

 

$time = "2007-06-16 14:02:49";

echo date("F j, Y", strtotime($time));

//Output: June 6, 2007

Also, here's a tutorial on the subject: http://www.phpfreaks.com/forums/index.php/topic,95430.0.html

Link to comment
https://forums.phpfreaks.com/topic/55865-chop-sting/#findComment-275998
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.