Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

changing year only

Posted on 1997-12-18
3
Medium Priority
?
213 Views
Last Modified: 2010-04-21
does anyone know how to change the year only, without entering in other information such as month, hour, miniute, etc.  Or can i obtain a perl script which will automate this.  I have read the man pages and help files for
'date' but it will not let you enter one field at a time.  You must enter all required fields even if you only want to change only 1 field such as year.  I want to be able to leave the curent time as is, and only modify the year.  Can this be done, and if so, how?
0
Comment
Question by:tcblue
  • 2
3 Comments
 
LVL 85

Expert Comment

by:ozo
ID: 2008420
#!/usr/bin/perl -w
($s,$M,$H,$d,$m,$y) = localtime;
$m += 1;
$y += 1900;
$yy = shift || $y;
system(sprintf("date %02d%02d%02d%02d$yy.%02d",$m,$d,$H,$M,$s));

0
 

Expert Comment

by:grantk
ID: 2008421
Make a shellscript called "xdate", or something:
date `date "+%m%d%H%M$@ .%S"`

Call it with "xdate 98".
0
 

Accepted Solution

by:
grantk earned 100 total points
ID: 2008422
Make a shellscript called "xdate", or something:
date `date "+%m%d%H%M$@ .%S"`

Call it with "xdate 98".
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question