Hi Friends,
I am newbie to shell programming and I am stuck trying to accomplish following task.We use Bamboo CI which executes script1 passing parameters. This Main script executes script2 as backend process as part of one of it statements. Task of script2 is to essentially check whether a... (0 Replies)
Hello All,
I have written a script which which is working fine to a certain logic of it. But i want a part of the script to run two commands at 00:10 hrs every day. These two command are
1. rm -rf /path/to/folder
2. mail the content of a file.
How do i achieve this. Thanks.
... (4 Replies)
Hello,
I have two crontabs, one for the root and one for another user. There is a script in my configurations that has to send a email. The script works and sends the emails when I run it by hand with either the root or the user, and when I program it in the root's crontab.
But! It does not... (3 Replies)
Hello All,
I was wondering if anyone knew of a way to find out what commands were run on a specific date.
I'm looking to see if I can find certain commands that were run on 3/4, today is 3/10...?
Any thoughts or ideas would be much appreciated!
Thanks in Advance,
Matt
----------... (3 Replies)
Hello Friends,
I need you help !
I have a scripts names runsteps.sh which contains command to run bunch of commands for each application you want to install " Oracle " Jboss" etc
echo " Which app you want to install Jboss" ? Yes or no?
read ans
depending on Yes or not it goes inside... (3 Replies)
Hi ,
How would i write a shell script to run the code from one date to another date EXample 2014-01-01 to 2014-02-28, can i any provide some clue on this (4 Replies)
Hi all,
I have this script which sends mail whenever the system is down. It works fine. Normally the system is down from 21 00 to 21 30 from Monday to Saturday and from 21 00 on Sunday to Monday 06 00 for maintenance. So I want the below script to run only when the system is up, i.e outside the... (2 Replies)
Linux System having all Perl, Python, PHP (and Ruby) installed
From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file
eg
eg
a Shell script run in a case statement call to run a php file, also Perl or/and Python file???
Like
#!/usr/bin/bash
....
....
case $INPUT_STRING... (1 Reply)
Hi Team,
I have a to run a script based on a date present in a different file which updates everyday. Kindly help with the solution.
My current execution : ksh scriptname.sh 10152019. But here i want to enter this date from a file which gets updated daily.
My appraoch :
date file location:... (3 Replies)
Discussion started by: midhun3108
3 Replies
LEARN ABOUT PHP
datetime.__construct
DATETIME.__CONSTRUCT(3) 1 DATETIME.__CONSTRUCT(3)DateTime::__construct - Returns new DateTime object
Object oriented style
SYNOPSIS
public DateTime::__construct NULL ([string $time = "now"], [DateTimeZone $timezone])
DESCRIPTION
Procedural style
DateTime date_create NULL ([string $time = "now"], [DateTimeZone $timezone])
Returns new DateTime object.
PARAMETERS
o $time
-A date/time string. Valid formats are explained in Date and Time Formats. Enter NULL here to obtain the current time when using
the $timezone parameter.
o $timezone
- A DateTimeZone object representing the timezone of $time. If $timezone is omitted, the current timezone will be used.
Note
The $timezone parameter and the current timezone are ignored when the $time parameter either is a UNIX timestamp (e.g.
@946684800) or specifies a timezone (e.g. 2010-01-28T15:00:00+02:00).
RETURN VALUES
Returns a new DateTime instance. Procedural style returns FALSE on failure.
ERRORS /EXCEPTIONS
Emits Exception in case of an error.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.0 | |
| | |
| | If $time contains an invalid date/time format, |
| | then an exception is now thrown. Previously an |
| | error was emitted. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
DateTime.__construct(3) example
Object oriented style
<?php
try {
$date = new DateTime('2000-01-01');
} catch (Exception $e) {
echo $e->getMessage();
exit(1);
}
echo $date->format('Y-m-d');
?>
Procedural style
<?php
$date = date_create('2000-01-01');
if (!$date) {
$e = date_get_last_errors();
foreach ($e['errors'] as $error) {
echo "$error
";
}
exit(1);
}
echo date_format($date, 'Y-m-d');
?>
The above examples will output:
2000-01-01
Example #2
Intricacies of DateTime.__construct(3)
<?php
// Specified date/time in your computer's time zone.
$date = new DateTime('2000-01-01');
echo $date->format('Y-m-d H:i:sP') . "
";
// Specified date/time in the specified time zone.
$date = new DateTime('2000-01-01', new DateTimeZone('Pacific/Nauru'));
echo $date->format('Y-m-d H:i:sP') . "
";
// Current date/time in your computer's time zone.
$date = new DateTime();
echo $date->format('Y-m-d H:i:sP') . "
";
// Current date/time in the specified time zone.
$date = new DateTime(null, new DateTimeZone('Pacific/Nauru'));
echo $date->format('Y-m-d H:i:sP') . "
";
// Using a UNIX timestamp. Notice the result is in the UTC time zone.
$date = new DateTime('@946684800');
echo $date->format('Y-m-d H:i:sP') . "
";
// Non-existent values roll over.
$date = new DateTime('2000-02-30');
echo $date->format('Y-m-d H:i:sP') . "
";
?>
The above example will output something similar to:
2000-01-01 00:00:00-05:00
2000-01-01 00:00:00+12:00
2010-04-24 10:24:16-04:00
2010-04-25 02:24:16+12:00
2000-01-01 00:00:00+00:00
2000-03-01 00:00:00-05:00
SEE ALSO DateTime.createFromFormat(3), DateTimeZone.__construct(3), Date and Time Formats, date.timezone ini setting, date_default_time-
zone_set(3), DateTime.getLastErrors(3), checkdate(3).
PHP Documentation Group DATETIME.__CONSTRUCT(3)