Welcome! Log In Create A New Profile

Advanced

PHP Eleven - Date and Time Functions in PHP

Posted by 77959132 NeoGek 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
PHP Eleven - Date and Time Functions in PHP
March 01, 2013 05:51AM
Have had to edit a Date function in Joomla before and struggled for ages...now much clearer and I have a cool guide for future referance. Done!
avatar Re: PHP Eleven - Date and Time Functions in PHP
March 04, 2013 09:01PM
Love the date function.

One very nice use for this function is on a copyright year stamp in the footer - if you use this you will not have to go edit it in the beginning of every year..

____________________________________________Nazi Coder____________________________________________

I'm not antisocial, I'm just not user friendly

"It's not a bug; it's an undocumented feature!" ~ some unknown Microsoft developer
Re: PHP Eleven - Date and Time Functions in PHP
March 05, 2013 09:35AM
ahhh - good 1 Shado, i never thought about doing that. I will use that from now on.
Re: PHP Eleven - Date and Time Functions in PHP
March 05, 2013 10:06AM
yeah thats a handy feature thanks shado.. section done.. time to dabble with DB's booja grinning smiley

Student number : 7803-010-2
Email and Gtalk for support : wilcovandeijl@gmail.com
avatar Re: PHP Eleven - Date and Time Functions in PHP
March 14, 2013 06:38AM
Done with this chapter. Dates can be interesting and complex, good explanations in this section, so many date options! Wow!
Re: PHP Eleven - Date and Time Functions in PHP
March 17, 2013 10:16AM
Date and time i found it so easy and i liked it since you have 3 different ways to output it
Re: PHP Eleven - Date and Time Functions in PHP
March 18, 2013 09:31PM
The date() will come in handy when we have to time stamp some events that occur when a user is accessing the system. For example the time when the changes were made to the DB could be time stamped.
Re: PHP Eleven - Date and Time Functions in PHP
March 20, 2013 10:38AM
thanks shado for the tip, never thot of it that way, will definitely remember that wen i program, otherwise chapter was straightforward...chapter done

..&ru..
Re: PHP Eleven - Date and Time Functions in PHP
March 20, 2013 11:01AM
done. funny that the "date" function does time aswell.
avatar Re: PHP Eleven - Date and Time Functions in PHP
March 20, 2013 11:33PM
The date() function seems pretty straight forward.
You hand in the format of the date and it will display it.
The formatting of dates can be very useful.
For example, to display the date and time on the server.
I guess you could even use this function to format the date and time of a blog post.
Re: PHP Eleven - Date and Time Functions in PHP
March 21, 2013 07:38PM
It is always useful to know the date and time smiling smiley
avatar Re: PHP Eleven - Date and Time Functions in PHP
March 22, 2013 12:04AM
Paste this code in one of your php files and check what happens smile

Language: PHP
<?php $year = 2013; $leap = date(';L';, mktime(0, 0, 0, 1, 1, $year)); echo $year . '; '; . ($leap ? ';is'; : ';is not';) . '; a leap year.';; ?>

____________________________________________Nazi Coder____________________________________________

I'm not antisocial, I'm just not user friendly

"It's not a bug; it's an undocumented feature!" ~ some unknown Microsoft developer
Re: PHP Eleven - Date and Time Functions in PHP
March 22, 2013 09:38AM
It is always useful to know when its leap-year, so that you can bring forth the lame jokes smiling smiley :

Why did the frog cross the road?
It was a LEAPPP year

Nice bit of code Shado smiling smiley.
avatar Re: PHP Eleven - Date and Time Functions in PHP
March 22, 2013 09:50AM
If you change the code slightly you can automate the year so you do not need to change it every year smile

Language: PHP
<?php $year = date(';Y';); $leap = date(';L';, mktime(0, 0, 0, 1, 1, $year)); echo $year . '; '; . ($leap ? ';is'; : ';is not';) . '; a leap year.';; ?>

____________________________________________Nazi Coder____________________________________________

I'm not antisocial, I'm just not user friendly

"It's not a bug; it's an undocumented feature!" ~ some unknown Microsoft developer
avatar Re: PHP Eleven - Date and Time Functions in PHP
March 26, 2013 10:42PM
Date and time function section done. Well understood except I can remember all the functions and codes off hand. I will have to keep a reference page for all the functions.

Thank for the codes there Shado.
Re: PHP Eleven - Date and Time Functions in PHP
April 10, 2013 09:57AM
i feel you on that! Too many codes to deal with...one has to keep referring to them till it sticks. The most important thing to learn, i think, is to know what is needed to be done at every given scenario!

78026962 afojonny
Re: PHP Eleven - Date and Time Functions in PHP
April 14, 2013 11:49AM
its done
Re: PHP Eleven - Date and Time Functions in PHP
May 21, 2013 10:58AM
DONE!Can see this coming in handy in future applications. Keeping notes as there is A LOT of code to learn PHEW!!
avatar
Mac
Re: PHP Eleven - Date and Time Functions in PHP
May 23, 2013 08:25AM
When you need to do something, see what PHP has available. That is the way to go. There is almost always a built-in function to help you achieve something. So no need to learn it all - you search for it when you have a need. If that makes sense...
Re: PHP Eleven - Date and Time Functions in PHP
May 23, 2013 09:16AM
Yes Mac, you're on point. It makes a lot of sense.

78026962 afojonny
Re: PHP Eleven - Date and Time Functions in PHP
May 24, 2013 09:08AM
I see what you are saying here Mac and it makes sense, I guess google is our best friend smiling smiley I can see me googling A LOT haha. Thanks for the wise words Mac smile
Re: PHP Eleven - Date and Time Functions in PHP
May 24, 2013 09:47AM
I will die if Google has to go away for a week. I will probably take a break, go on a vacation until Google comes back LOL
Re: PHP Eleven - Date and Time Functions in PHP
May 24, 2013 10:56AM
I call it Prof Google!...lol

78026962 afojonny
Re: PHP Eleven - Date and Time Functions in PHP
May 24, 2013 11:44AM
UNIGOOGLE
avatar Re: PHP Eleven - Date and Time Functions in PHP
May 24, 2013 11:52AM
Hi there,

Well, I once read somewhere that Einstein didn't bother to remember his own phone number, because he said he can always look it up in the phone book. I suppose Google is our "phone book" spinning smiley sticking its tongue out

Cheers
Re: PHP Eleven - Date and Time Functions in PHP
May 25, 2013 12:14AM
smile

78026962 afojonny
avatar Re: PHP Eleven - Date and Time Functions in PHP
May 27, 2013 10:12AM
Nice one!!! I think one can say Google in a voice like Golem from LOTR "my precious"!!



77929284 Wrote:
-------------------------------------------------------
> Hi there,
>
> Well, I once read somewhere that Einstein didn't
> bother to remember his own phone number, because
> he said he can always look it up in the phone
> book. I suppose Google is our "phone book" spinning smiley sticking its tongue out
>
> Cheers
Sorry, only registered users may post in this forum.

Click here to login