Hi all,
I've a shell script which runs on Bourne shell. I've to do a date comparison. If the value of the supplied parameter(in format YYYYMMDD)is greater than todays's date(format YYYYMMDD), it should prompt the user that the supplied date is greater than today's date. The script is given... (6 Replies)
Hi
I have this simple script:
#!/bin/bash
date1=2009:07:15:12:36
date2=2009:07:15:12:16
echo $date1
echo $date2
datediff=
#datediff=date1-date2
echo datediff is$datediff
How do i return the difference in seconds? (6 Replies)
1. The problem statement, all variables and given/known data:
I have standard web server log file. It contains different columns (like IP address, request result code, request type etc) including a date column with the format .
I have developed a log analysis command line utility that displays... (1 Reply)
Date comparison
Hello all
I am writing a scrip that will take action so long as the date with in the file is older than 3 months. The file will contain multiple rows of data. Each row will probably start with the date. My question... What is the exact code that should be used for date... (1 Reply)
Hi friends,
I would like to compare two dates in an IF statement.
This is what I am trying, but it doesn't work.
date=20120122
minus=6
if ; then
...
fi
what would the IF clause looks like?
Thanks! :) (5 Replies)
hi,
I have a file named user.cfg under /var/member/
#user.cfg file under /var/member/
login user: root #how are you
login pass: admin #where are you
M: user1 pass1 #20121008
M: user2 pass2 #20111230
M: user3 pass3 #20091220
M: user4 pass4 #20070210
M: user5 pass5 #20130708
M:... (3 Replies)
I have below txt file
02.05.2014
10.05.2014
17.09.2014
My requirement is the user enter date field should compare the input file
if user enter date as 12.03.2013 it should compare with all date one by one from input file
12.03.2013 -ne 02.05.2014
12.03.2013 -ne 10.05.2014... (3 Replies)
Hey everyone,
I'm trying to create a script using awk and if that will list all of our aws tapes that have archived date that is past 90 days from todays current date, so that I can pass that to my aws command to remove.
The fifth column is the creation date in epoch/seconds, so I'm... (13 Replies)
Discussion started by: beyondmondays
13 Replies
LEARN ABOUT PHP
datefmt_format_object
DATEFMT_FORMAT_OBJECT(3) 1 DATEFMT_FORMAT_OBJECT(3)IntlDateFormatter::formatObject - Formats an object
Object oriented style
SYNOPSIS
publicstatic string IntlDateFormatter::formatObject (object $object, [mixed $format = NULL], [string $locale = NULL])
DESCRIPTION
Procedural style string datefmt_format_object (object $object, [mixed $format = NULL], [string $locale = NULL])
This function allows formatting an IntlCalendar or DateTime object without first explicitly creating a IntlDateFormatter object.
The temporary IntlDateFormatter that will be created will take the timezone from the passed in object. The timezone database bundled with
PHP will not be used - ICU's will be used instead. The timezone identifier used in DateTime objects must therefore also exist in ICU's
database.
PARAMETERS
o $object
- An object of type IntlCalendar or DateTime. The timezone information in the object will be used.
o $format
- How to format the date/time. This can either be an array with two elements (first the date style, then the time style, these
being one of the constants IntlDateFormatter::NONE, IntlDateFormatter::SHORT, IntlDateFormatter::MEDIUM, IntlDateFormatter::LONG,
IntlDateFormatter::FULL), a long with the value of one of these constants (in which case it will be used both for the time and the
date) or a string with the format described in the ICU documentation. If NULL, the default style will be used.
o $locale
- The locale to use, or NULL to use the default one.
RETURN VALUES
A string with result or FALSE on failure.
EXAMPLES
Example #1
datefmt_format_object(3) examples
<?php
/* default timezone is irrelevant; timezone taken from the object */
ini_set('date.timezone', 'UTC');
/* default locale is taken from this ini setting */
ini_set('intl.default_locale', 'fr_FR');
$cal = IntlCalendar::fromDateTime("2013-06-06 17:05:06 Europe/Dublin");
echo "default:
",
IntlDateFormatter::formatObject($cal),
"
";
echo "long $format (full):
",
IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL),
"
";
echo "array $format (none, full):
",
IntlDateFormatter::formatObject($cal, array(
IntlDateFormatter::NONE,
IntlDateFormatter::FULL)),
"
";
echo "string $format (d 'of' MMMM y):
",
IntlDateFormatter::formatObject($cal, "d 'of' MMMM y", 'en_US'),
"
";
echo "with DateTime:
",
IntlDateFormatter::formatObject(
new DateTime("2013-09-09 09:09:09 Europe/Madrid"),
IntlDateFormatter::FULL,
'es_ES'),
"
";
The above example will output:
default:
6 juin 2013 17:05:06
long $format (full):
jeudi 6 juin 2013 17:05:06 heure d'ete irlandaise
array $format (none, full):
17:05:06 heure d'ete irlandaise
string $format (d 'of' MMMM y):
6 of June 2013
with DateTime:
lunes, 9 de septiembre de 2013 09:09:09 Hora de verano de Europa central
PHP Documentation Group DATEFMT_FORMAT_OBJECT(3)