perl time format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl time format
# 1  
Old 08-11-2009
perl time format

Hay guys,

I used time::local module. But i can't get my proper answer from this.

I want to extract two time for tomorrow start time and end time. In my code i just hard coded this. But it's not running for every day na. I need to create these time from any function or module.

my $TomStartDate = '2009-08-12 00:00:00';
my $TomEndDate = '2009-08-12 23:59:59';

Thanks in Advance
# 2  
Old 08-11-2009
How about something like
Code:
@nextday = localtime(time + 86400);

printf("%02d/%02d/%02d",$nextday[4]+1,$nextday[3],($nextday[5]+1900)%100)

# 3  
Old 08-11-2009
Quote:
Originally Posted by pritish.sas
Hay guys,

I used time::local module. But i can't get my proper answer from this.

I want to extract two time for tomorrow start time and end time. In my code i just hard coded this. But it's not running for every day na. I need to create these time from any function or module.

my $TomStartDate = '2009-08-12 00:00:00';
my $TomEndDate = '2009-08-12 23:59:59';

Thanks in Advance
Extract two times from what? Please try and be more specific.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calculate Time diff in milli milliseconds(Time format : HH:MM:SS,NNN)

Hi All, I have one file which contains time for request and response. I want to calculate time difference in milliseconds for each line. This file can contain 10K lines. Sample file with 4 lines. for first line. Request Time: 15:23:45,255 Response Time: 15:23:45,258 Time diff... (6 Replies)
Discussion started by: Raza Ali
6 Replies

2. HP-UX

DATE and TIME format help in HP-UX

Hello, I have date format as shown in red color below Fri, Sep 12, 2012 08:38:05 PM Can anyone help me with command to change this format to yyyy-mm-dd and HH:MM:SS Note: Time should be in 24 hours format I really appreciate your help!! Thanks, Elavarasan (4 Replies)
Discussion started by: Elavarasan
4 Replies

3. Shell Programming and Scripting

perl module to convert xlsx format to xls format

Hi Folks, I have written a perl script that reads data from excel sheet(.xls) using Spreadsheet::ParseExcel module. But the problem is this module doesn't work for excel sheets with extension .xlsx. I have gone through Spreadsheet::XLSX module with which we can read from .xlsx file directly.... (1 Reply)
Discussion started by: giridhar276
1 Replies

4. Shell Programming and Scripting

time format

Hello Guys. I have copied the following from the time man pages time -f "%E real,%U user,%S sys" ls -Fs But I am getting -f: command not found Regards (3 Replies)
Discussion started by: fdc2suxs
3 Replies

5. Shell Programming and Scripting

Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time.

How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ? Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 Replies

6. Shell Programming and Scripting

Convert Epoch time format to normal date time format in the same file

I have a file named "suspected" with series of line like these : {'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''} {'protocol': 17, 'service': 'BitTorrent... (3 Replies)
Discussion started by: rk4k
3 Replies

7. Shell Programming and Scripting

help in time format

how to grep 30 mins from starting time of script let for example,script runs at 02:00am....i want to grep from 01.30 till 02:00 ------------------------------------------------------------------- how to achive this in a k-shell script ? (3 Replies)
Discussion started by: ali560045
3 Replies

8. Shell Programming and Scripting

time format..

HI.. I have some files...when doing "ls -l" its like this.. -rwxr-xr-x 1 e2e e2e 747 Aug 30 15:18 abc.txt how can I get the number YYYYMMDD from this...( since I need to compare this number with some other value..) with the help of date/awk/sed/epoch or whatever u... (1 Reply)
Discussion started by: clx
1 Replies

9. Shell Programming and Scripting

Cron time format

Hi, i would like to ask if this cron is valid. 40 3-6,8-23 * * * /my command i want my job to run every hour on the 40th minute except 740am. Is this correct? (1 Reply)
Discussion started by: new2ss
1 Replies
Login or Register to Ask a Question