DATE_PARSE_FROM_FORMAT(3) 1 DATE_PARSE_FROM_FORMAT(3)date_parse_from_format - Get info about given date formatted according to the specified formatSYNOPSIS
array date_parse_from_format (string $format, string $date)
DESCRIPTION
Returns associative array with detailed info about given date.
PARAMETERS
o $format
- Format accepted by DateTime.createFromFormat(3).
o $date
- String representing the date.
RETURN VALUES
Returns associative array with detailed info about given date.
EXAMPLES
Example #1
date_parse_from_format(3) example
<?php
$date = "6.1.2009 13:00+01:00";
print_r(date_parse_from_format("j.n.Y H:iP", $date));
?>
The above example will output:
Array
(
[year] => 2009
[month] => 1
[day] => 6
[hour] => 13
[minute] => 0
[second] => 0
[fraction] =>
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 0
[errors] => Array
(
)
[is_localtime] => 1
[zone_type] => 1
[zone] => -60
[is_dst] =>
)
SEE ALSO DateTime.createFromFormat(3), checkdate(3).
PHP Documentation Group DATE_PARSE_FROM_FORMAT(3)
Check Out this Related Man Page
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)
Hello
I want to get end date of the any month in unix . is there any function to do this.
we can get month from date command 'date +%b'
example:
If Feb month then last date is 28
if sep then last date 30. like this
thanks
please help (12 Replies)
Cound anyone help me on how to compare date in Unix using if function on bash file?
current=date
if ###syntax is wrong, could anyone correct it for me
then
rm -rf /usr/local/src
fi
Thank You... (17 Replies)
Hi,
I need a recursive program which when run appends todays date,month and year automatically to the existing file names..
I have aaa.txt file with some 90 odd file names.
aa.bb_cc
aa.bb_cc
.
.
.
aa.yy.zz
When the script is run for today,it should give me like..
... (22 Replies)
:confused: Hi there.
Hi frndz,
I have to script a shell in such a way that by giving the current date, it should give the previous saturday date and next sunday date as output.
eg: Input - 01-01-2008
O/p -
last saturady- 30-12-2007(ddmmyy)
Next Sunday- 05-01-2008
... (14 Replies)
Hii
i am trying to take the month and date from the "date" command and using it in a variable.
output from date command :
Wed Oct 1 03:01:27 MST 2008
I took the month and date into a variable by using the cut command.
d=$(echo `date` | cut -c 5-10)
when am trying to print the variable... (16 Replies)
Hi guys,
I need to find tomorrows date in date fomat and should be in variable.
as I need to grep this date in a flat file
ie. if today's date is '09 JAN 2009'
output should be '10 JAN 2009'
unix/perl script will be fine. (21 Replies)
hii all.
I have to get the date of the 7th day past from the current date.
if i give the current date as sep 3 then i must get the date as 27th of august.
can we get the values from the "cal" command.
cal | awk '{print $2}' will this type of command work.
actually my need is
if today is... (17 Replies)
Hi all,
I need to write a unix shell script that will return the previous date of date entered and i have to consider leap year also.
For eg:- if i entered 2009-08-18 then the script should return 2009-08-17
can you please help me to write this... (12 Replies)
Folks ,
Trying to create a script / command that kills an application process , but on the ones that are from the current date backwards. So far I have everything working minus the "date" part. Can you help me ?
current command :
kill -9 `ps -aef | grep app_name | grep -v grep | awk... (13 Replies)
Can someone help me on my issue please :)
I have a table like this format:
# cat myfile.txt
Employee Gender NAME Last Login
ID Time
-------------------------------------------------
210125 M ABC ... (15 Replies)
I have a requirement where the user send a file. If the file is empty they put datetimestamp(YYYYMMDDHH:MM:SS) otherwise they would be data.
I can do cat and get whats in file but how can I see if the data is date timestamp.
In short,
if format(data in file) = YYYYMMDDHH:MM:SS then... (13 Replies)
hi all,
i'm trying to create a script inorder to put load test on hard drives.
first i create 30GB file
dd if=/dev/zero of=50gb.img bs=5gb count=10
then i'd like to create 100 loops continuous until it fills up.
once its done delete file.
this is where i'm stuck for for loops.
can... (18 Replies)
Hi there,
I miss date information when executing # dmesg
Is it possible to add this a date information to my results of # dmesg
?
Best wishes (12 Replies)
Hi,
I want to put script. The script is to show file that larger than 100MB include current date (eg: today date).
After find the date, it will compress list file and split the tar.gz file. Any idea how to do that?
This bash script will run auto everyday. It's will transfer will to other... (12 Replies)
current date command runs well
awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat
subtract 30 days fails
awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat
awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)