03-14-2011
it's giving me this error
-bash$ date -d'1 hour ago' +%Y%m%d%H
date: illegal option -- d
usage: date [-u] mmddHHMM[[cc]yy][.SS]
date [-u] [+format]
date -a [-]sss[.fff]
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a .tar file consisting of text and binary files. I ftp'd the .tar file using ftp binary.
when I did the pax to unwind the tar file, I noiticed that the text files were encoded in binary.
**How would I retain the text characteristics of the ascii text files, while also keeping the... (11 Replies)
Discussion started by: idic5
11 Replies
2. Shell Programming and Scripting
Hi All,
I am working with a fixed width file Forrmat.
C1 Number (10,3)
C2 Number (10,3)
e.g.
c1= 0000000100.000
c2= 0000000020.000
0000000100.0000000000020.000
I have to perform c1 - c2 . i.e. I want answer to be 0000000080.000. but I am loosing the leading zeros( only getting... (3 Replies)
Discussion started by: Manish Jha
3 Replies
3. Shell Programming and Scripting
Guys,
Please can you tell me how to retain 3 latest files in a directory and get rid of the rest ?
Thanks very much
Regards,
Ganesh (6 Replies)
Discussion started by: kamathg
6 Replies
4. Shell Programming and Scripting
There are directories of files that I have to run the dos2ux command on to get ride of the carriage return characters. Easy enough, but I have to retain the original timestamps on the files. I am thinking that I am going to have to strip off the timestamp for each file and convert it to unix time... (3 Replies)
Discussion started by: scotbuff
3 Replies
5. Shell Programming and Scripting
I have large file with around 100k+ lines. I wanted to retain only the last 100 lines in that file. One way i thought was using
tail -1000 filename > filename1
mv filename1 filename
But there should be a better solution.. Is there a way I can use sed or any such command to change the... (9 Replies)
Discussion started by: nss280
9 Replies
6. Shell Programming and Scripting
Hi All,
I am in need of help to retain particular rows. I have a large file with 5 columns. Column 3 has signs like “=” “>” “<” and column 5 has values “nm” “%” or empty space.
I need to keep only rows which have “=” in column 3 and “nm” in column 5. How can I do it in awk? Any help is greatly... (3 Replies)
Discussion started by: newpro
3 Replies
7. Shell Programming and Scripting
Replace and retain entries.
I have a certain users that will replaced a certain values, but if it has already a value it will retain its values.
Thanks
Data to be placed:
account_locked = false
loginretries = 0
pwdwarntime = 0
... (4 Replies)
Discussion started by: kenshinhimura
4 Replies
8. Shell Programming and Scripting
Hi all,
I have space delimated file which look like this
1 2 3 4
5 6 7 8
9 1 0 11
I am using simple awk command to read the second column
awk '{print $2}' input_file
but i got the output like this which also read 10 from the third column
2
6... (8 Replies)
Discussion started by: bsn2011
8 Replies
9. UNIX for Advanced & Expert Users
Hi,
I have a script which transfers files/directories from one HP unix to another HP unix server using SCP but i need to retain ownership of files/folders same as source server my script is as follows
cd /sasdata/TR_CNTO328/C0328T07/Dry_Run_1/Macros
find . -type d -newer . -exec scp -pr {}... (6 Replies)
Discussion started by: tushar_spatil
6 Replies
10. Shell Programming and Scripting
Ive been trying to google and tried sed and awk. BUt still getting no exact formula.
I would like to know how to parse this at:
From:
Compute Machin Appliance 3.2.9.10000 123456
To:
Compute Machin Appliance 3.2.9.123456 (5 Replies)
Discussion started by: kenshinhimura
5 Replies
LEARN ABOUT PHP
datetime.setisodate
DATETIME.SETISODATE(3) 1 DATETIME.SETISODATE(3)
DateTime::setISODate - Sets the ISO date
Object oriented style
SYNOPSIS
public DateTime DateTime::setISODate (int $year, int $week, [int $day = 1])
DESCRIPTION
Procedural style
DateTime date_isodate_set (DateTime $object, int $year, int $week, [int $day = 1])
Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.
PARAMETERS
o $object
-Procedural style only: A DateTime object returned by date_create(3). The function modifies this object.
o $year
- Year of the date.
o $week
- Week of the date.
o $day
- Offset from the first day of the week.
RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.3.0 | |
| | |
| | Changed the return value on success from NULL to |
| | DateTime. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
DateTime.setISODate(3) example
Object oriented style
<?php
$date = new DateTime();
$date->setISODate(2008, 2);
echo $date->format('Y-m-d') . "
";
$date->setISODate(2008, 2, 7);
echo $date->format('Y-m-d') . "
";
?>
Procedural style
<?php
$date = date_create();
date_isodate_set($date, 2008, 2);
echo date_format($date, 'Y-m-d') . "
";
date_isodate_set($date, 2008, 2, 7);
echo date_format($date, 'Y-m-d') . "
";
?>
The above examples will output:
2008-01-07
2008-01-13
Example #2
Values exceeding ranges are added to their parent values
<?php
$date = new DateTime();
$date->setISODate(2008, 2, 7);
echo $date->format('Y-m-d') . "
";
$date->setISODate(2008, 2, 8);
echo $date->format('Y-m-d') . "
";
$date->setISODate(2008, 53, 7);
echo $date->format('Y-m-d') . "
";
?>
The above example will output:
2008-01-13
2008-01-14
2009-01-04
Example #3
Finding the month a week is in
<?php
$date = new DateTime();
$date->setISODate(2008, 14);
echo $date->format('n');
?>
The above examples will output:
3
SEE ALSO
DateTime.setDate(3), DateTime.setTime(3).
PHP Documentation Group DATETIME.SETISODATE(3)