Need User Inputted Date

 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Need User Inputted Date
# 1  
Old 01-28-2011
Need User Inputted Date

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
I'm making my first program with perl and am supposed to allow the user to either use the current date or enter a specific date they choose. The program then is supposed to print out the chosen date, as well as the week before.
Example:
Date: 1-28-2011
Sunday: 1-16-2011
Saturday: 1-22-2011

I have it working fine with printing out the the current date and last week but am unsure how to have the optional input from user as well as convert that into a date.

The optional input should be entered on the command line when the program is run such as: dates.pl 09/22/2004


2. Relevant commands, code, scripts, algorithms:
@AVRG
Date::Manip as well as Parse


3. The attempts at a solution (include all code and scripts):
I have tried using the @AVRG command but am not sure I'm using it right. I have @AVRG[0] because i just want the initial command inputted but if I do print $AVRG[0] nothing shows up.

And to parse the date I have tried using Date::manip but again am unsure how to use that properly.


4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
North Dakota State University
Fargo, North Dakota, USA
Tariq King, CSci 372


Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Need to get the next day's date of the user entered date

I need to get the next day's date of the user entered date for example: Enter date (yyyy/mm/yy): 2013/10/08I need to get the next day's date of the user entered date Desired Output: 2013/10/09Though there are ways to achieve this is Linux or Unix environment (date command) ,I need to... (1 Reply)
Discussion started by: rpm120
1 Replies

2. Shell Programming and Scripting

To get the files in a directory for the given date (User entered date)

Need a ksh script to get the files that were created or modified in a directory on a particular date entered by the user. For example if a directory contains files as below : > ll total 41 -rw-rw-r-- 1 psn psn 199 Aug 23 07:06 psn_roll.sh -rw-rw-r-- 1 psn psn ... (10 Replies)
Discussion started by: ramprabhum
10 Replies

3. Shell Programming and Scripting

How to read the user inputted file name?

hello, I have prepared a script ------------------------------------------------ #!/bin/sh cat test.txt| sed '1d' | sed '$d' > /tmp/tmp1.txt while read line do typeset -i count=`echo $line | tr ' ' '}' | wc -c` finalcount=`expr $count - 1` echo $finalcount done <... (12 Replies)
Discussion started by: rac
12 Replies

4. Programming

Converting a user inputted date to epoch time

Hi all , I need to know how to convert a time stamp entered by the user to be converted to GMT/UTC(epoch time) using mktime() and gmtime() for exapample the input will be put in the form ptm.tm_sec = 0; ptm.tm_min = 59; ptm.tm_hour = 11; ptm.tm_mday = 20;... (2 Replies)
Discussion started by: ada
2 Replies

5. Shell Programming and Scripting

Number of days between the current date and user defined date

I am trying to find out the number of days between the current date and user defined date. I took reference from here for the date2jd() function. Modified the function according to my requirement. But its not working properly. Original code from here is working fine. #!/bin/sh... (1 Reply)
Discussion started by: hiten.r.chauhan
1 Replies

6. Shell Programming and Scripting

How to increment a user defined date value in the DATE format itself using shell script?

I need to increment a date value through shell script. Input value consist of start date and end date in DATE format of unix. For eg. I need increment a date value of 1/1/09 to 31/12/09 i.e for a whole yr. The output must look like 1/1/09 2/2/09 . . . 31/1/09 . . 1/2/09 . 28/2/09... (1 Reply)
Discussion started by: sunil087
1 Replies

7. Shell Programming and Scripting

Substituting a user Inputted word into a command

I am creating a menu driven system and i want to show the last login times of different users, instead of using the 'last' command i wanted to know if there is anyway i could make a brief search tool where the user can input which user they are looking for and then the login times for that specific... (2 Replies)
Discussion started by: warlock129
2 Replies

8. Programming

Not able to see the inputted command on the shell prompt..but its executing the comnd

Hi , I m writing a program which involves piping(pipes). In my program, once i execute the child process (dealing with pipe),I m not able to see any inputted command on the screen....but the entered command is getting executed... Actaully inorder to implement piping i hav closed STDIN and... (3 Replies)
Discussion started by: Crab
3 Replies

9. Shell Programming and Scripting

How do I compare a filesize to an inputted number?

I need to create a shell script that takes 2 arguments, the first argument is any number, and the second argument is a filename. The script needs to indicate if the file's size is bigger or smaller than the number provided. I know it will be some kind of if/then, but I can't figure out how to... (1 Reply)
Discussion started by: Modoc
1 Replies

10. Shell Programming and Scripting

How to hide user inputted text for interactive unix shell script?

Hi everybody, Do you know how to hide the text for interactive unix shell script? Just like the case for inputting password during logon. Patrick (1 Reply)
Discussion started by: patrickpang
1 Replies
Login or Register to Ask a Question