Skip to main content

Two date compare in php

if two date compare then follow following steps :

1-convert two date in same formate using date function,

2-convert date into time format using php function -
function : strtotime()

3-then compare two date using if() condition,


Eg:

<?php



#Variable ::



$date1=date('Y m d H:i:s');

$date2=date('Y-M-d H:i:s');



#conver date into time formate ::-



$date1time=strtotime($date1);

$date2time=strtotime($date2);



#if condtion compare two date ::



if($date1time==$date2time)

{

     echo 'two date are  equal ';

}  else 

{

  echo 'two date are not equal ';

}

Comments

Popular posts from this blog

Profile Share Fixing the Thumbnail Image, Title and Description for Shared Links

Profile Share Fixing the Thumbnail Image, Title and Description for Shared Links user want to share any information then use following code  and read step by step Profile Share Fixing the Thumbnail Image, Title and Description for Shared Links if you want share profile on following social link : 1-Facebook 2-twitter.com 3-LinkedIn 4-google +, Code link : https://drive.google.com/open?id=1IzTZZh_0euDqFSHL_vPRiQePlNTw3h-q Demo link : http://freeteachnology.hol.es/socialshare/ To modify a page's thumbnail image, description, and additional metadata for these services, you can provide meta tags in the HTML code of the page.Implementing Open Graph Meta Tags You can implement meta tags in a number of ways. In content management systems might  be allow you to modify a page's meta tags , then use following code in meta section of your project code, <link href="bootstrap.min.css" rel="stylesheet"> <link href="bootstrap-tour.m...

using PDO database connection add,update,delete,edit operation

PDO advantage : 1-Object Oriented 2-Bind parameters in statements (security) 3-Allows for prepared statements and rollback functionality (consistency) 4-Throws catcheable exceptions for better error handling (quality) 5-Exception mode; no need to check error state after each API call. It's best to tell PDO how you'd like the data to be fetched. You have the following options: 1-PDO::FETCH_ASSOC: returns an array indexed by column name. 2-PDO::FETCH_BOTH: (default):returns an array indexed by both column name and number. 3-PDO::FETCH_BOUND:Assigns the values of your columns to the variables set with the ->bindColumn() method. 4-PDO::FETCH_CLASS: Assigns the values of your columns to properties of the named class. It will create the properties if matching properties do not exist. 5-PDO::FETCH_INTO:Updates an existing instance of the named class. 6-PDO::FETCH_LAZY: Combines. 7-PDO::FETCH_BOTH/PDO:FETCH_OBJ, creating the object variable names as t...

Ajax Asynchronous and synchronus using jquery

What is jQuery 1-jQuery is a fast and concise JavaScript Library created by John Resig in 2006 with a nice motto - 2-Write less, do more. 3-jQuery simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. Following feature of jQuery : 1-DOM manipulation − The jQuery made it easy to select DOM elements, traverse them and modifying their content by using cross-browser open source selector engine called Sizzle. 2-Event Handling : The jQuery offers an elegant way to capture a wide variety of events,such as click,over event, 3-Ajax Support : jQuery support ajax technology, 4- Lightweight : he jQuery is very lightweight library - about 19KB in size ( Minified and gzipped ) . 5-Animations − The jQuery comes with plenty of built-in animation effects. 6-Cross Br...