Jump to content

installing Date Class


Recommended Posts

Hi, I am trying to use some Date class functions and getting this error:

 

code:

 

// date class test

$date = new Date(date("j"), date("n"), date("Y"));

echo "Today is : " . $date . "</br>";

 

 

error:

Fatal error: Class 'Date' not found in /var/www/html/test.php

 

 

 

I did some dig in and realized--i think--that the Date class library comes from this:

 

http://pecl.php.net/package/date_time

 

 

however this is C code and not php code. My question is how do I "install" these classes into my php folder (I am using Centos)?

 

Do I have to compile the code? Is there a way to install it without having to compile the code? Is there a pre-built lib somewhere?

 

thx!

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/107899-installing-date-class/
Share on other sites

I tried this and it didn't work either:

 

[root@localhost Date]# pecl install date_time

Failed to download pecl/date_time within preferred state "stable", latest release is version 0.1, stability "alpha", use "channel://pecl.php.net/date_time-0.1" to install

Cannot initialize 'channel://pecl.php.net/date_time', invalid or missing package file

Package "channel://pecl.php.net/date_time" is not valid

install failed

 

 

any clues? thx.

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.