To alter perl /bin/date output by - 5 hours


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To alter perl /bin/date output by - 5 hours
# 1  
Old 08-16-2005
Question To alter perl /bin/date output by - 5 hours

Hello!

I'm using a perl script which calls the time and
date from a remote server using the line

/bin/date -

What is needed in this line to
reduce the output time
5 hours?

Thanks

Last edited by Texan; 08-17-2005 at 09:25 AM..
# 2  
Old 08-16-2005
Computer use --date

Assuming it's GNU date, you can use the --date switch, like so:

Code:
/bin/date --date "5 hours ago" "+%a..."

# 3  
Old 08-17-2005
MySQL

Hit that nail on the head
with your eyes closed.

You the man!

Thank you Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert string to date and add 1 hours

i have some set of date data inside csv files and need to convert the timezone, 08302016113611861 08302016113623442 08302016113541570 08302016113557732 08302016113548439 08302016112853115 08302016113620684 08302016113432827 08302016113630321 date format is : %m%d%Y%H%M%Smilisec ... (2 Replies)
Discussion started by: before4
2 Replies

2. Shell Programming and Scripting

Alter awk script to reformat output

Data: 0,mfrh_green_screen,1455432969,37540,/prod/test/system/sys/unikixmain.log,3.0M,mfrh_green_screen,3120660,0,36964--37540 0,mfrh_green_screen,1455433269,38100,/prod/test/system/sys/unikixmain.log,3.1M,mfrh_green_screen,3164223,0,37540--38100... (1 Reply)
Discussion started by: SkySmart
1 Replies

3. Shell Programming and Scripting

Display date from twelve hours ago

HI Guys I want to create date folder in unix base on currant date minus 12 hours. Ex: Currant date :07222013 and time is 1 Am So the folder will create date :07212013 (6 Replies)
Discussion started by: pareshkp
6 Replies

4. UNIX for Dummies Questions & Answers

Adding hours and minutes to current date (Only to date not to time)

Hi, I want to add some hours and minutes to the current date. For example, if the current date is "July 16, 2012 15:20", i want to add 5 hours 30 minutes to "July 16, 2012 00:00" not to "July 16, 2012 15:20". Please help. Thanks! (4 Replies)
Discussion started by: manojgarg
4 Replies

5. Shell Programming and Scripting

Adding hours to current date

Hi, any idea how to add hours to current date in unix. thanks in advance (9 Replies)
Discussion started by: Abhijeet_Atti
9 Replies

6. Shell Programming and Scripting

Test if a file has a last modified date of within the last 24 hours

Hi there Im trying to find a way to test whether the last modified time is older than 1 day or not so #!/bin/bash if ; then $TOUCHED = "recently" else $TOUCHED = "not so recently" fi ive seen loads of posts where people are using find and the -mtime property but i... (2 Replies)
Discussion started by: rethink
2 Replies

7. Shell Programming and Scripting

Why does my /bin/csh take longer than /bin/perl?

Okay, so I have two "Hello, world!" scripts, "test.pl" and "test.sh". #!/bin/perl -w use strict; print "Hello, world!\n"; #!/bin/csh echo Hello,\ world! When I run test.pl, it runs instantly, always. When I run test.sh, it takes anywhere between 4 and 22 seconds! I'd like to know what... (3 Replies)
Discussion started by: acheong87
3 Replies

8. Shell Programming and Scripting

modifying date (-10 hours) in the content of a file

Dear Experts, I have a problem. I have a file which has contents such as below, with about 500K lines 34|1|532|2008.10.24 23:41:13|2-1-1-13|90130060128441171|CO0402|0|0x00000201A402000021F6005D4901EC1C2000|0|0|0xE00319FFFFBFFFFE| with field separator "|", the 4th field is the date (date... (3 Replies)
Discussion started by: aismann
3 Replies

9. Shell Programming and Scripting

Scripts to output contents every 3 hours

Hi all, I would like to capture the file contents every 3 hours. I will put the schedule inside crontab, how to get only incremental contents from the last 3 hours? Thanks. (4 Replies)
Discussion started by: *Jess*
4 Replies

10. UNIX for Dummies Questions & Answers

How to subtract 2 hours from 'date' in shell ( /bin/sh ) script ?

I write a sh script that zip and copy to tape all files that older then 2 hours. 1. The way I choose is - touch a file with "now - 2 hours", then use fine with '! -newer' 2. Do you have any other idea to do it ? tnx. (1 Reply)
Discussion started by: yairon
1 Replies
Login or Register to Ask a Question