Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dateinterval(3) [php man page]

DATEINTERVAL(3) 							 1							   DATEINTERVAL(3)

The DateInterval class

INTRODUCTION
Represents a date interval. A date interval stores either a fixed amount of time (in years, months, days, hours etc) or a relative time string in the format that DateTime's constructor supports. CLASS SYNOPSIS
DateInterval DateInterval Properties o public integer$y o public integer$m o public integer$d o public integer$h o public integer$i o public integer$s o public integer$invert o public mixed$days Methods o public DateInterval::__construct (string $interval_spec) o publicstatic DateInterval DateInterval::createFromDateString (string $time) o public string DateInterval::format (string $format) PROPERTIES
o $y - Number of years. o $m - Number of months. o $d - Number of days. o $h - Number of hours. o $i - Number of minutes. o $s - Number of seconds. o $invert - Is 1 if the interval represents a negative time period and 0 otherwise. See DateInterval::format. o $days - If the DateInterval object was created by DateTime.diff(3), then this is the total number of days between the start and end dates. Otherwise, $days will be FALSE. Before PHP 5.4.20/5.5.4 instead of FALSE you will receive -99999 upon accessing the prop- erty. PHP Documentation Group DATEINTERVAL(3)

Check Out this Related Man Page

DATEINTERVAL.CREATEFROMDATESTRING(3)					 1				      DATEINTERVAL.CREATEFROMDATESTRING(3)

DateInterval::createFromDateString - Sets up a DateInterval from the relative parts of the string

SYNOPSIS
publicstatic DateInterval DateInterval::createFromDateString (string $time) DESCRIPTION
Uses the normal date parsers and sets up a DateInterval from the relative parts of the parsed string. PARAMETERS
o $time - A date with relative parts. Specifically, the relative formats supported by the parser used for strtotime(3) and DateTime will be used to construct the DateInterval. EXAMPLES
Example #1 Parsing valid date intervals <?php // Each set of intervals is equal. $i = new DateInterval('P1D'); $i = DateInterval::createFromDateString('1 day'); $i = new DateInterval('P2W'); $i = DateInterval::createFromDateString('2 weeks'); $i = new DateInterval('P3M'); $i = DateInterval::createFromDateString('3 months'); $i = new DateInterval('P4Y'); $i = DateInterval::createFromDateString('4 years'); $i = new DateInterval('P1Y1D'); $i = DateInterval::createFromDateString('1 year + 1 day'); $i = new DateInterval('P1DT12H'); $i = DateInterval::createFromDateString('1 day + 12 hours'); $i = new DateInterval('PT3600S'); $i = DateInterval::createFromDateString('3600 seconds'); ?> RETURN VALUES
Returns a new DateInterval instance. PHP Documentation Group DATEINTERVAL.CREATEFROMDATESTRING(3)
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding days to an input date.

Hello Unix gurus, I need to add days to the input date and further use it in comparision with the existing date. Im having issues sto add days to date,can you guys help me with script or function with which I can add days to the date. Thanks, Sud (10 Replies)
Discussion started by: sud
10 Replies

2. Shell Programming and Scripting

How to convert hex numbers to decimal ?

Hi, please tell me how to convert hex number to decimal 000000E7 000000000002640D 0000000000025B16 and seconds to minutes, hours, days, months, years bytes to kbytes, mbytes , gbytes read the following examples while read a b do printf "%5d %5d\n" "0x$a" "0x$b" done < "$FILE"... (15 Replies)
Discussion started by: jack2
15 Replies

3. Shell Programming and Scripting

Replace x Number of String Occurrence with Sed

Ok, So I have a huge file that has over 12000 lines in it. in this file, there are 589 occurrences of the string "use five-minute-interval" spread in various areas in the file. How can i replace the the last 250 of the occurrences of "use five-minute-interval" with "use... (10 Replies)
Discussion started by: SkySmart
10 Replies

4. Shell Programming and Scripting

Replace date on a line with current date

Hi Guys, I have a file with following content From 20121014 : To 20121014 Number of days : 1 1234 1245 1246 1111 Everyday i run my script i want to modify "To" date on the first line with current date. I have set the current date in script as RUN_DATE=`date -u +%Y%m%d` So i want... (9 Replies)
Discussion started by: jakSun8
9 Replies

5. Shell Programming and Scripting

Script to filter by date

Hello, I currently have the need to perform backup, naming the file by date. How do I get the script, you can choose the most current file or current date and then upload it? My script is related to this topic that is already closed. Read Post Can anyone help me? (12 Replies)
Discussion started by: hdegenaro
12 Replies

6. Ubuntu

Suggest books for understanding Ubuntu Linux

recommend books to understand ubuntu ...... (14 Replies)
Discussion started by: vyom
14 Replies

7. Shell Programming and Scripting

Subtract 2 date columns in .csv file and get output as number of days

Hi, I have one .csv file. I have 2 date columns present in file, column 2 and column 3. I need to calculate how many days exist between 2 dates. I am trying to subtract date column 2 from date column 3. Eg: my file look likes s.no, Start_date,End_Date 1, 7/29/2012,10/27/2012 2,... (9 Replies)
Discussion started by: Dimple
9 Replies

8. What is on Your Mind?

I'm back

Hi all, I used to post here years ago, and was a moderator, my old username: zazzybob. Anyway, after a few years away focusing on my career, I'm back and keener than ever to get involved in the unix.com community again. I'm looking forward to getting back into the swing of things, helping... (11 Replies)
Discussion started by: tokiwinter
11 Replies

9. Shell Programming and Scripting

Function into a condition ?

Hello, How can i put a function into a condition ? g1 is my function I tested this in vain if g1 $1 $2 $3 -ne 0 ];thenif ;then Thanks for yours suggestions (18 Replies)
Discussion started by: amazigh42
18 Replies

10. Programming

SQL date for last seven days

Hi team, i have a condition in sql where we have as below select sum(column_A) from temp_t where date >= tdb_datestr_to_epoch('21/11/1995 10:00:00','dd/mm/yyyy hh24:mi:ss') and date < tdb_datestr_to_epoch('22/11/1995 10:00:00','dd/mm/yyyy hh24:mi:ss') the problems is i have to do the... (9 Replies)
Discussion started by: zozoo
9 Replies

11. Homework & Coursework Questions

Helpm with time function

I want to print the difference (in days) between ($7) and the oldest record date ($6) based on unique ID ($5) on a new field. In addition, I want to subtract oldest date from recent dates(in days) ($6) for each unique ID ($5). Here is the data looks like 7 81 1 47 32070 2010-12-14 ... (11 Replies)
Discussion started by: alula
11 Replies

12. Shell Programming and Scripting

Identifying missing file dates

Hi Experts, I have written the below script to check the missing files based on the date in the file name from current date to in a given interval of days. In the file names we have dates along with some name. ex:jera_sit_2017-04-25-150325.txt. The below script is working fine if we have only... (10 Replies)
Discussion started by: nalu
10 Replies

13. Shell Programming and Scripting

Get number of days between 2 dates

Gents. Please can u help. I would like to calculate the days between two dates. Example file1 ( previous date) file1 - Input file 9/29/2010 10195 9/29/2010 1057 2/2/2016 10 2/2/2016 10169 2/2/2016 1057 2/3/2016 10005 2/3/2016 10014 In file2 I add the actual date using this code.... (9 Replies)
Discussion started by: jiam912
9 Replies

14. What is on Your Mind?

Cut Over to New Data Center and Upgraded OS Done. :)

Three days ago we received an expected notice from our long time data center that they were going dark on Sept 12th. About one and a half hours ago, after three days of marathon work, I just cut over the unix.com to a new data center with a completely new OS and Ubuntu distribution. (22 Replies)
Discussion started by: Neo
22 Replies

15. UNIX for Beginners Questions & Answers

Replace integer string in a variable based on month?

Hi Folks - Linux Version = Linux 2.6.39-400.128.17.el5uek x86_64 I have a process that determines the start and end load periods for an Oracle data load process. The variables used are as follows follows: They are populated like such: However, the load requires the month to be the... (11 Replies)
Discussion started by: SIMMS7400
11 Replies