Jump to content

Chop Sting


arun4444

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.