SlideShare a Scribd company logo
For date and time function we know first few things in our
mind
Date and time function
Capital S Year Day Month
Th,rd,st y—17 d=06 m=03
Example--1st Y—2017 n= 6 M=mar
l= Monday,tue.... F=march
D=Mon J=3
By using
[date_default_timezone_get();
using this function we can get the
time which is by default set.
date_default_timezone_set(“Asian/Calcutt
a”);
By using this function we can get the
current time of the current city or
country.
To set the time
 date_default_timezone_set(“Asian/Culcu
tta”);
 Echo date(“h:i:s a); date(h:i:s A);
 Date(h:i:p); date(h:i:s P);
 Am-anti mariadian
 Pm-post mariadian
Define the time
 G-24hr-1,2,3,4,5---------13,14,15,--------
22,23
 H-24hr-01,02,03,04,05----13,14,15------
22,23
 g-12hr-1,2,3,4,5,--------11,12,1,2,3,-------11
 h-12hr-01,02,03-----11,12,01,02,03-------11
 date_default_timezone_set(“Asian/Calcutta”)
;
 echo date(“d,l,F,y,g:i:s a”);
 Output- 06,Monday,March,17 10:58:06 am
Example
We also get output like below
 echo date(todayis l);
 Output---today is Monday
 echo “today is “.date(“l”);
 Output---today is Monday
echo time();
 By using this function we can get the number
of seconds and we can also call it as unix
timestamp. (1971-2017(or current time))
 echo (time()-1296000); 129600 is 15 days sec
 echo date(“y-m-d h:i:s a”,(time()-+1296000));
 o/p-17-02-19 11:10:50am (15 day back if -
1296000) or +1296000 then its (17-03-21
11:10:51)
Strtotime();
using this function we can get
the time of befor or after any
year (like 10 years ,20 years
before or after)
 strtotime(-10 years);
 strtotime(+20 years);
Example-difference between the date or years
 $birth=“1990-02-12”;
 $past=strtotime($birth);
 $curr=time();
 echo(($curr-$past)/(86400*365)); year
 86400 is seconds for a day
 echo(($curr-$past)/(86400*30)); month
 echo(($curr-$past)/(86400*7)); week

More Related Content

Viewers also liked

Lei prince el padrino de la bachata
Lei prince   el padrino de la bachata Lei prince   el padrino de la bachata
Lei prince el padrino de la bachata
Lei Glø
 
Çiçeklerin Dünyası, World of Flowers IV
Çiçeklerin Dünyası, World of Flowers IVÇiçeklerin Dünyası, World of Flowers IV
Çiçeklerin Dünyası, World of Flowers IV
***
 
Peningkatan mutu agregat ringan beton bertulang ringan struktural untuk bangu...
Peningkatan mutu agregat ringan beton bertulang ringan struktural untuk bangu...Peningkatan mutu agregat ringan beton bertulang ringan struktural untuk bangu...
Peningkatan mutu agregat ringan beton bertulang ringan struktural untuk bangu...
Krismanto Mahendra
 
Engineering geology & geomorphology
Engineering geology & geomorphologyEngineering geology & geomorphology
Engineering geology & geomorphology
Priodeep Chowdhury
 
Sistema digestivo
Sistema digestivoSistema digestivo
Sistema digestivo
ana_grave
 
Horarios y aulas primer cuatrimestre 2017- al 01 de marzo 2017
Horarios y aulas  primer cuatrimestre 2017- al 01 de marzo 2017Horarios y aulas  primer cuatrimestre 2017- al 01 de marzo 2017
Horarios y aulas primer cuatrimestre 2017- al 01 de marzo 2017
Voces Del Valle
 
Guide to investing in the Australian mining industry - March 2017
Guide to investing in the Australian mining industry - March 2017Guide to investing in the Australian mining industry - March 2017
Guide to investing in the Australian mining industry - March 2017
Darren Fooks
 
Actividad 8: Paulina Ramos Castro 6°A
Actividad 8: Paulina Ramos Castro 6°AActividad 8: Paulina Ramos Castro 6°A
Actividad 8: Paulina Ramos Castro 6°A
Paulina Ramos Castro
 
Perspectives 2017: Pat Bradley
Perspectives 2017: Pat BradleyPerspectives 2017: Pat Bradley
Perspectives 2017: Pat Bradley
Touchstone Institute
 
Volumenes de transito_2010_2011
Volumenes de transito_2010_2011Volumenes de transito_2010_2011
משחקי בילוש פרזנטציה, אלונים אור יהודה
משחקי בילוש פרזנטציה, אלונים אור יהודהמשחקי בילוש פרזנטציה, אלונים אור יהודה
משחקי בילוש פרזנטציה, אלונים אור יהודה
Dr. Peri Sinclair
 
Visite sous la mer puis sur terre
Visite sous la mer puis sur terreVisite sous la mer puis sur terre
Visite sous la mer puis sur terre
Bernard Aboab
 
Congestion de transito -el problema y como enfrentarlo-CEPAL 87
Congestion de transito -el problema y como enfrentarlo-CEPAL 87Congestion de transito -el problema y como enfrentarlo-CEPAL 87
Congestion de transito -el problema y como enfrentarlo-CEPAL 87
UNIVERSIDAD LIBRE PEREIRA -Colombia. UNIVERSIDAD ANTONIO NARIÑO-Pereira
 
2 lina-y-diego-nic1
2 lina-y-diego-nic12 lina-y-diego-nic1
2 lina-y-diego-nic1
Alejandro Duque
 
功夫微講堂第五卷
功夫微講堂第五卷功夫微講堂第五卷
功夫微講堂第五卷
美棻Nancy 魏Wei
 
Des belles a Canet
Des belles a CanetDes belles a Canet
Des belles a Canet
Balcon60
 

Viewers also liked (16)

Lei prince el padrino de la bachata
Lei prince   el padrino de la bachata Lei prince   el padrino de la bachata
Lei prince el padrino de la bachata
 
Çiçeklerin Dünyası, World of Flowers IV
Çiçeklerin Dünyası, World of Flowers IVÇiçeklerin Dünyası, World of Flowers IV
Çiçeklerin Dünyası, World of Flowers IV
 
Peningkatan mutu agregat ringan beton bertulang ringan struktural untuk bangu...
Peningkatan mutu agregat ringan beton bertulang ringan struktural untuk bangu...Peningkatan mutu agregat ringan beton bertulang ringan struktural untuk bangu...
Peningkatan mutu agregat ringan beton bertulang ringan struktural untuk bangu...
 
Engineering geology & geomorphology
Engineering geology & geomorphologyEngineering geology & geomorphology
Engineering geology & geomorphology
 
Sistema digestivo
Sistema digestivoSistema digestivo
Sistema digestivo
 
Horarios y aulas primer cuatrimestre 2017- al 01 de marzo 2017
Horarios y aulas  primer cuatrimestre 2017- al 01 de marzo 2017Horarios y aulas  primer cuatrimestre 2017- al 01 de marzo 2017
Horarios y aulas primer cuatrimestre 2017- al 01 de marzo 2017
 
Guide to investing in the Australian mining industry - March 2017
Guide to investing in the Australian mining industry - March 2017Guide to investing in the Australian mining industry - March 2017
Guide to investing in the Australian mining industry - March 2017
 
Actividad 8: Paulina Ramos Castro 6°A
Actividad 8: Paulina Ramos Castro 6°AActividad 8: Paulina Ramos Castro 6°A
Actividad 8: Paulina Ramos Castro 6°A
 
Perspectives 2017: Pat Bradley
Perspectives 2017: Pat BradleyPerspectives 2017: Pat Bradley
Perspectives 2017: Pat Bradley
 
Volumenes de transito_2010_2011
Volumenes de transito_2010_2011Volumenes de transito_2010_2011
Volumenes de transito_2010_2011
 
משחקי בילוש פרזנטציה, אלונים אור יהודה
משחקי בילוש פרזנטציה, אלונים אור יהודהמשחקי בילוש פרזנטציה, אלונים אור יהודה
משחקי בילוש פרזנטציה, אלונים אור יהודה
 
Visite sous la mer puis sur terre
Visite sous la mer puis sur terreVisite sous la mer puis sur terre
Visite sous la mer puis sur terre
 
Congestion de transito -el problema y como enfrentarlo-CEPAL 87
Congestion de transito -el problema y como enfrentarlo-CEPAL 87Congestion de transito -el problema y como enfrentarlo-CEPAL 87
Congestion de transito -el problema y como enfrentarlo-CEPAL 87
 
2 lina-y-diego-nic1
2 lina-y-diego-nic12 lina-y-diego-nic1
2 lina-y-diego-nic1
 
功夫微講堂第五卷
功夫微講堂第五卷功夫微講堂第五卷
功夫微講堂第五卷
 
Des belles a Canet
Des belles a CanetDes belles a Canet
Des belles a Canet
 

Recently uploaded

"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
Fwdays
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
ScyllaDB
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
DanBrown980551
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
Fwdays
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
Mydbops
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
Sunil Jagani
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
AlexanderRichford
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
Fwdays
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
christinelarrosa
 

Recently uploaded (20)

"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba"NATO Hackathon Winner: AI-Powered Drug Search",  Taras Kloba
"NATO Hackathon Winner: AI-Powered Drug Search", Taras Kloba
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
ScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking ReplicationScyllaDB Tablets: Rethinking Replication
ScyllaDB Tablets: Rethinking Replication
 
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
LF Energy Webinar: Carbon Data Specifications: Mechanisms to Improve Data Acc...
 
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
"Scaling RAG Applications to serve millions of users",  Kevin Goedecke"Scaling RAG Applications to serve millions of users",  Kevin Goedecke
"Scaling RAG Applications to serve millions of users", Kevin Goedecke
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Must Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during MigrationMust Know Postgres Extension for DBA and Developer during Migration
Must Know Postgres Extension for DBA and Developer during Migration
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptxAI in the Workplace Reskilling, Upskilling, and Future Work.pptx
AI in the Workplace Reskilling, Upskilling, and Future Work.pptx
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
QR Secure: A Hybrid Approach Using Machine Learning and Security Validation F...
 
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin..."$10 thousand per minute of downtime: architecture, queues, streaming and fin...
"$10 thousand per minute of downtime: architecture, queues, streaming and fin...
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Christine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptxChristine's Product Research Presentation.pptx
Christine's Product Research Presentation.pptx
 

PHP Date and Time Function

  • 1. For date and time function we know first few things in our mind Date and time function Capital S Year Day Month Th,rd,st y—17 d=06 m=03 Example--1st Y—2017 n= 6 M=mar l= Monday,tue.... F=march D=Mon J=3
  • 2. By using [date_default_timezone_get(); using this function we can get the time which is by default set. date_default_timezone_set(“Asian/Calcutt a”); By using this function we can get the current time of the current city or country.
  • 3. To set the time  date_default_timezone_set(“Asian/Culcu tta”);  Echo date(“h:i:s a); date(h:i:s A);  Date(h:i:p); date(h:i:s P);  Am-anti mariadian  Pm-post mariadian
  • 4. Define the time  G-24hr-1,2,3,4,5---------13,14,15,-------- 22,23  H-24hr-01,02,03,04,05----13,14,15------ 22,23  g-12hr-1,2,3,4,5,--------11,12,1,2,3,-------11  h-12hr-01,02,03-----11,12,01,02,03-------11
  • 5.  date_default_timezone_set(“Asian/Calcutta”) ;  echo date(“d,l,F,y,g:i:s a”);  Output- 06,Monday,March,17 10:58:06 am Example
  • 6. We also get output like below  echo date(todayis l);  Output---today is Monday  echo “today is “.date(“l”);  Output---today is Monday
  • 7. echo time();  By using this function we can get the number of seconds and we can also call it as unix timestamp. (1971-2017(or current time))  echo (time()-1296000); 129600 is 15 days sec  echo date(“y-m-d h:i:s a”,(time()-+1296000));  o/p-17-02-19 11:10:50am (15 day back if - 1296000) or +1296000 then its (17-03-21 11:10:51)
  • 8. Strtotime(); using this function we can get the time of befor or after any year (like 10 years ,20 years before or after)  strtotime(-10 years);  strtotime(+20 years);
  • 9. Example-difference between the date or years  $birth=“1990-02-12”;  $past=strtotime($birth);  $curr=time();  echo(($curr-$past)/(86400*365)); year  86400 is seconds for a day  echo(($curr-$past)/(86400*30)); month  echo(($curr-$past)/(86400*7)); week