The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl, time stamp issue. 60th minutes supaLucas Shell Programming and Scripting 3 03-31-2009 02:16 AM
Generating files with time interval of fifteen minutes aajan Shell Programming and Scripting 0 09-25-2007 02:54 AM
Adding # minutes to current time... gptavares UNIX for Advanced & Expert Users 7 06-25-2007 04:10 PM
how to display time in minutes n seconds... santy Shell Programming and Scripting 1 08-23-2006 11:18 AM
How can I create a file with current time - 60 minutes DaveyTN Shell Programming and Scripting 4 10-05-2005 09:17 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-21-2009
vikash_k vikash_k is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 11
how to find the time before 30 minutes

Hi All,

I want to find out the time before 30 minutes. I am able to do with in hours limit.

date
Fri Aug 21 06:50:00 BST 2009

TZ=CST+1 date
Fri Aug 21 04:50:02 CST 2009

Can any one please help me
  #2 (permalink)  
Old 08-21-2009
Leppie's Avatar
Leppie Leppie is offline
Registered User
  
 

Join Date: Aug 2009
Posts: 71
why are you working on 2 different time zones?
  #3 (permalink)  
Old 08-21-2009
BubbaJoe's Avatar
BubbaJoe BubbaJoe is offline
Registered User
  
 

Join Date: Oct 2008
Location: St Louis
Posts: 153
If you are using bash you can try using the --date option. Sonething like this

Code:
sh-3.2$ date
Fri Aug 21 01:16:57 CDT 2009
sh-3.2$ date --date="Fri Aug 21 01:16:57 -4:30"
Fri Aug 21 00:46:57 CDT 2009
sh-3.2$

  #4 (permalink)  
Old 08-21-2009
panyam panyam is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2008
Posts: 474

Code:
perl -le 'print scalar localtime (time() - 2*60*60);'

  #5 (permalink)  
Old 08-24-2009
vikash_k vikash_k is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 11
Quote:
Originally Posted by panyam View Post
Code:
perl -le 'print scalar localtime (time() - 2*60*60);'
Thanks a lot. This is what i was expecting. As i am new to perl. Could you please tell me hoie can i pass parameterized value to this command. As after some time my requirement is changed for 50 mins instead of 30 mins.
  #6 (permalink)  
Old 08-24-2009
agn agn is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 172

Code:
$ date -d '-30 min'

on Linux.
  #7 (permalink)  
Old 08-24-2009
panyam panyam is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2008
Posts: 474
Something Like this :


Code:
var=50
perl -le "print scalar localtime (time() -  "$var"*60);"

To be frank i am not much aware of the "perl", how ever this one i was using for date related issues. So posted.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:48 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0