|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Date in Solaris
Hi, I am working on date operations in perl. using following code, I am getting today date as per my required format. Code:
my $date1 = `date '+%m/%d/%Y'`; can I find day+1 date. (ie. If today is 12/01/2009 then I want to edit above code t find 12/02/2009) ---------- Post updated 12-02-09 at 01:58 AM ---------- Previous update was 12-01-09 at 08:28 PM ---------- can anyone please advice |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
Why do you call an external program for something that Perl can do fine by itself? Code:
$ cat time.pl #!/usr/bin/perl use strict; use warnings; my $time = time; my @today = localtime($time); my @tomorrow = localtime( $time + 24 * 60 * 60 ); printf " Today: %02d/%02d/%04d\n", $today[4] + 1, $today[3], $today[5] + 1900; printf "Tommorow: %02d/%02d/%04d\n", $tomorrow[4] + 1, $tomorrow[3], $tomorrow[5] + 1900; $ perl time.pl Today: 12/02/2009 Tommorow: 12/03/2009 See the Perl documentation for time, localtime, and gmtime for more information. Last edited by pludi; 12-02-2009 at 05:36 AM.. Reason: corrected code |
| Sponsored Links | ||
|
|
|
#3
|
|||
|
|||
|
Will it give me 12/01/2009 after 11/30/2009. It shouldnt be 11/31/2009.
Also how to take it in a variable? Last edited by gentleDean; 12-02-2009 at 04:30 AM.. Reason: Asked one more question |
|
#4
|
||||
|
||||
to Code:
my $time = 1259578800; # 2009-11-30 12:00:00 PM and run it again. |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| date -d compatibility on Solaris | pavanlimo | Shell Programming and Scripting | 3 | 04-03-2009 02:06 AM |
| date -d nightmare on Solaris | pavanlimo | Solaris | 1 | 04-02-2009 11:34 AM |
| Find solaris os installation date | vadivukumar | Solaris | 6 | 10-08-2008 11:57 AM |
| change system date in solaris | murad.jaber | Solaris | 10 | 03-24-2008 03:12 AM |
| Install Date of Solaris Machine | smoothstylez | UNIX for Dummies Questions & Answers | 2 | 07-08-2005 12:15 PM |
|
|