Jump to content

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.

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.