Strict Standards: Non-static method Advanced_Permalinks::get() should not be called statically in /blog/wp-content/plugins/advanced-permalinks/advanced-permalinks.php on line 825

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GoogleSitemapGeneratorLoader::Enable() should not be called statically in /blog/wp-includes/plugin.php on line 123

Warning: call_user_func_array() expects parameter 2 to be array, null given in /blog/wp-includes/plugin.php on line 123
[PHP] Operacje na datach pobieranych z formularzy w formacie RRRR-MM-DD » Porady PHP » egrafik.pl
BAZA WIEDZY
KURSY
Bazy danych w PHP
Kurs AdvancedAJAX
Kurs ASP
Kurs ASP.NET
Kurs C++
Kurs CSS
Kurs HTML
Kurs HTML drugi
Kurs JavaScript
Kurs MySQL
Kurs PHP
Kurs RSS
Kurs XHTML
Obiekty DOM
MANUALE
CSS1 - W3C
DOM - w budowie
PHP 2005
PHP 2006
Wyrażenia regularne
SHOUTBOX
STAT
Online: 5 | UU: 344

Strict Standards: Resource ID#115 used as offset, casting to integer (115) in /forum2/db/mysql4.php on line 223

Strict Standards: Resource ID#115 used as offset, casting to integer (115) in /forum2/db/mysql4.php on line 224
[PHP] Operacje na datach pobieranych z formularzy w formacie RRRR-MM-DD
Porady PHP | 16 luty 2009 | Wizyt: 106864

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Strict Standards: Only variables should be assigned by reference in /blog/wp-includes/post.php on line 114

Deprecated: Function eregi() is deprecated in /blog/wp-content/plugins/tpbc.php on line 96

W tej poradzie przedstawię kilka operacji na datach w formacie RRRR-MM-DD. Taki format może być np. pobierany z formularzy podczas podawania daty urodzenia.

Przykład:

Kod: php

<?php
$data_urodz = ‘1981-03-04′;
$data_obecna = date("Y-m-d");
$data_urodz_unix = strtotime($data_urodz);
$data_obecna_unix = strtotime($data_obecna);

$roznica_lata = ($data_obecna_unix - $data_urodz_unix) / (60*60*24*365.25);
$roznica_dni = ($data_obecna_unix - $data_urodz_unix) / (60*60*24);
$roznica_godziny = ($data_obecna_unix - $data_urodz_unix) / (60*60);
$roznica_minuty = ($data_obecna_unix - $data_urodz_unix) / (60);

echo "Minely ".$roznica_lata." lata od daty Twoich urodzin <br />";
echo "Minely ".$roznica_dni." dni od daty Twoich urodzin <br />";
echo "Minely ".$roznica_godziny." godziny od daty Twoich urodzin <br />";
echo "Minely ".$roznica_minuty." minuty od daty Twoich urodzin <br />";
?>

Pod zmienną $data_urodz możesz podstawić swoją datę urodzenia, a poznasz kilka ciekawych faktów.

Autor: Adam Suchowski

nowe Porady PHP » zobacz wszystkie
Dodaj komentarz









Komentarze
8 odpowiedzi
17 lipiec 2017, godz. 7:50

Hey There. I found your blog the use of msn. This is an extremely smartly
written article. I’ll make sure to bookmark it and return to learn more of your helpful info.
Thanks for the post. I will definitely comeback.

12 lipiec 2017, godz. 3:36

Hi there it’s me, I am also visiting this site daily, this web site is in fact good and the viewers are actually sharing good thoughts.

16 czerwiec 2017, godz. 1:29

Hello, everything is going perfectly here and
ofcourse every one is sharing information, that’s genuinely excellent,
keep up writing.

13 czerwiec 2017, godz. 1:18

The other day, while I was at work, my sister stole
my iphone and tested to see if it can survive a 40 foot drop, just so she
can be a youtube sensation. My iPad is now broken and she has 83 views.
I know this is totally off topic but I had to share it with someone!

10 czerwiec 2017, godz. 6:45

Its like you read my mind! You seem to know a lot about this, like you wrote
the book in it or something. I think that you can do with a few pics to drive the message home a bit, but instead of that, this is fantastic blog.
A fantastic read. I’ll certainly be back.

26 maj 2017, godz. 4:46

It’s in fact very difficult in this full of activity life to listen news on Television, so
I simply use internet for that purpose, and get the most recent news.

xxx
25 marzec 2017, godz. 8:52

I blog quite often and I really appreciate your information. This article has really peaked my interest.
I am going to book mark your website and keep checking for new details about once per week.

I opted in for your RSS feed as well.

10 styczeń 2016, godz. 8:57

naturally like your web site however you need to test the spelling on quite a few
of your posts. A number of them are rife with spelling problems and I in finding it very troublesome to tell the reality then again I will certainly come
again again.

 
| | | |
Copyright © 2006-2013 egrafik.pl | Kontakt | Reklama | Projekty domów
jocker