SlideShare une entreprise Scribd logo
1  sur  9
Télécharger pour lire hors ligne
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

Contenu connexe

En vedette

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
 

En vedette (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
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

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