DATETIME.GETLASTERRORS(3) 1 DATETIME.GETLASTERRORS(3)DateTime::getLastErrors - Returns the warnings and errors
Object oriented style
SYNOPSIS
publicstatic array DateTime::getLastErrors (void )
DESCRIPTION
Procedural style
array date_get_last_errors (void )
Returns an array of warnings and errors found while parsing a date/time string.
PARAMETERS
This function has no parameters.
RETURN VALUES
Returns array containing info about warnings and errors.
EXAMPLES
Example #1
DateTime.getLastErrors(3) example
Object oriented style
<?php
try {
$date = new DateTime('asdfasdf');
} catch (Exception $e) {
// For demonstration purposes only...
print_r(DateTime::getLastErrors());
// The real object oriented way to do this is
// echo $e->getMessage();
}
?>
Procedural style
<?php
$date = date_create('asdfasdf');
print_r(date_get_last_errors());
?>
The above examples will output:
Array
(
[warning_count] => 1
[warnings] => Array
(
[6] => Double timezone specification
)
[error_count] => 1
[errors] => Array
(
[0] => The timezone could not be found in the database
)
)
The indexes 6, and 0 in the example output refer to the character index in the string where the error occurred.
PHP Documentation Group DATETIME.GETLASTERRORS(3)
Check Out this Related Man Page
DATETIME.GETTIMESTAMP(3) 1 DATETIME.GETTIMESTAMP(3)DateTime::getTimestamp - Gets the Unix timestamp
Object oriented style
SYNOPSIS
public int DateTime::getTimestamp (void )
DESCRIPTION
int DateTimeImmutable::getTimestamp (void ) int DateTimeInterface::getTimestamp (void )
Procedural style
int date_timestamp_get (DateTimeInterface $object)
Gets the Unix timestamp.
PARAMETERS
This function has no parameters.
RETURN VALUES
Returns the Unix timestamp representing the date.
EXAMPLES
Example #1
DateTime.getTimestamp(3) example
Object oriented style
<?php
$date = new DateTime();
echo $date->getTimestamp();
?>
Procedural style
<?php
$date = date_create();
echo date_timestamp_get($date);
?>
The above examples will output something similar to:
1272509157
NOTES
Using U as the parameter to DateTime.format(3) is an alternative when using PHP 5.2.
SEE ALSO DateTime.setTimestamp(3), DateTime.format(3).
PHP Documentation Group DATETIME.GETTIMESTAMP(3)
Here is my code:
DATETIME=1214163003
echo $DATETIME | sed 's/....//' | sed 's/....$//' | read DATEHOUR
echo $DATETIME | sed 's/......//' | sed 's/..$//' | read DATEMIN
echo $DATEHOUR
echo $DATEMIN
The idea is that i need the 16 stored in DATEHOUR and the 30 stored in DATEMIN but when... (4 Replies)
i am reading an i/p file input.txt as below and want to read all filenames as in highlighted in bold below and put them in a different file output.txt. can someone help me with a shell script to do this? thanks in advance
regards
brad
input.txt
---------
START
TYPE:OPT
INIT_SEQ:01... (8 Replies)
hi guys,
i have script like below:
if
then
DATETIME=${1}
fi
pls can anyone explain what does ${1} means? what if i have i have two arguments and have {2} added to the if cond? any links to get this claruified on the syntax? (4 Replies)