Jump to content

date


brown2005

Recommended Posts

[code]
<?php
function parsedate($date){
  $str = strtotime($date);
  $today = date('Y-m-d');
  $todaystr = strtotime($today);
  $diff = $todaystr-$str;
  $newdate = date('l jS \of F Y',time()- $diff);
  return $newdate;
}
?>
[/code]

Im not sure if it is necessary to use this:
  $today = date('Y-m-d');
  $todaystr = strtotime($today);

Perhaps i could have simpy used the time() function, but i wasn't sure if i may run into problems given that the format of the date being passed to the function is the Y-m-d and as such will not include the time for any hours during that day.
Link to comment
https://forums.phpfreaks.com/topic/17858-date/#findComment-76630
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.