473,549 Members | 2,723 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Find difference of two time in unix format

2 New Member
How can I find the time difference of two times in UNIX format
Jun 20 '16 #1
2 1547
Anju Alphones
2 New Member
first find the difference in unix format as:

Expand|Select|Wrap|Line Numbers
  1. $date1=strtotime("now");
  2. $date2=strtotime("last monday");
  3. $diff=abs($date1-$date2);
now we get the time difference in seconds. We can convert it to days or years as needed.
In days it will be $diff/(60*60*24);

that's all
Jun 20 '16 #2
Dormilich
8,658 Recognized Expert Moderator Expert
We can convert it to days or years as needed.
hoping that there is no DST (daylight saving time) or leap day inbetween.
Jun 21 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3268
by: Prafull Soni | last post by:
hi Can anyone give me program to find difference between two dates? thanks Prafull Soni
3
5913
by: Marauderz | last post by:
Hello guys, got a little question regarding the regional language settings . Anyway I got a Windows 2003 Server machine that was installed with the date format "dd/MM/yyyy" and location still locked in US. As we migrated certain apps over to the new machine. we found out something... someone coded a Now.ToString in a database query... and...
5
4476
by: Lyle A. Sieren | last post by:
Hello! Is there a way to output text in a unix format from vb.net? I am trying to complete a CIM load in Progress and I need the data to be in unix format. I tried using the following code but it left me with a line carriage return in the file (0d0a) outfilew.Write(group6) outfilew.Write(Environment.NewLine) Note:
2
1599
by: Lyle A. Sieren | last post by:
Hello! Sorry...I accidentally posted the last message before finishing it. How do you write a file in unix format from vb.net? I need it in unix format to complete a CIM load in Progress. I am trying to use the following code to write but this is not working properly. outfilew.Write(group6) outfilew.Write(Environment.NewLine) If I...
3
10875
by: taru | last post by:
Env: DB2 UDB 8.1 on AIX We are executing a db2 sql stored procedure which is invoked from a java client. The stored procedure contains few select, insert and update statements. Using the DB2 snapshot and event monitor we are able to find the time taken for the stored procedure execution. We want to find what is the execution time for...
4
3486
by: PengYu.UT | last post by:
Suppose I have a dos format text file. The following python code will print ^M at the end. I'm wondering how to print it in unix format. fh = open(options.filename) for line in fh.readlines() print line, Thanks, Peng
5
6387
by: Konstantinos Pachopoulos | last post by:
Hi, does any body now any such algorith? to find difference in days from YYYYMMDD to YYYYMMDD? Or just an algorithm, that converts YYYYMMDD to seconds since the epoch? Thanks
2
3178
by: manishamca | last post by:
can anyone say me how to find the difference of values present in two textbox and display the result in the third textbox. for eg: <input type=text name=t1 value=123> <input type=text name=t2 value=20> <input type=text name=t3 value=103> in the t3 textbox the difference of tw otextbox shuld be displayed as soon as...
1
3747
by: billa856 | last post by:
Hi, I am trying to insert Null value in column(ShipDate) in my table.That column(ShipDate)'s type id date/time and format is short date. I am using "" to insert Null in that column(ShipDate) but it shows warning that customer can't append all the records in the append query. Customer set 1 field(s) to Null due to a type conersion...
2
10263
akashazad
by: akashazad | last post by:
Dear Friends I would Like to know if there is any way we can find the Current Date format of the Server. I mean is there any Query or function by which we can find out the the Date format on SQL Server is either "MM/DD/YYYY" or "DD/MM/YYYY" or Any thing Else.
0
7520
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7450
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1941
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.