Jump to content

Determing The Day From A DateTime String.


Vermillion

Recommended Posts

You'll need to convert that into something usable by PHP's date funtions and from there it is easy to get the day of the week.  For example (the following could be mushed onto one line, it is split up for ease of understanding):

 

$date = '20100312122636';

// Grab date parts
$year  = substr($date, 0, 4);
$month = substr($date, 4, 2);
$day   = substr($date, 6, 2);

// Get the UNIX timestamp for the date
$timestamp = gmmktime(0, 0, 0, $month, $day, $year);

// Print the day of week
echo date('l', $timestamp);

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.