date problem -- URGENT


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting date problem -- URGENT
# 1  
Old 08-29-2006
date problem -- URGENT

Hi All,

When i run date command at unix prompt,
i get the output in format Tue Aug 29 12:36:18 GMT 2006

when i write the shell script i should be able to export the date output with format as YYYY/MM/DD-HH:MM:SS into some variable(ex : dateop).

and when i say echo ${dateop}
i should get output as the format i mentioned.

Please help me in this regard, it's my project requirement, urgent.

Regards,
Ravi Kumar Garlapati
# 2  
Old 08-29-2006
Get a manual on the date command for all the options.
Code:
$ date +%Y/%m/%d-%H:%M:%S
2006/08/29-07:57:19

# 3  
Old 08-29-2006
but that value should be able to store into a variable(say ex : dateop) in shell script
when i say echo ${dateop} in shellscript ,
i should be able to get the output as 2006/08/29-07:57:19

please help me.
# 4  
Old 08-29-2006
Code:
dateop=$(date +%Y/%m/%d-%H:%M:%S)
echo ${dateop}
2006/08/29-09:41:04

# 5  
Old 08-30-2006
Thanks a lot. I got my requirement satisfied.
Thanking you all once again. Smilie
# 6  
Old 08-30-2006
without a ' ' will that work ???
i mean dateop=$(date '+%Y/%m/%d-%H:%M:%S')
--- ---
will it work without ' ' ??
# 7  
Old 08-30-2006
again can you tell me why dateop=$(date '+....') is not working in SunOS ??
any thing wrong with me or what can you steer me in right way ?

Example : dateop=`date '+%m-%d-%Y'` kind of assignment working fine
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Urgent for date increment

hi all, i would like to increment the date variable i am using for((i=20190731;i<=20190801;i++)) do done after 20190731 it should be 20190801 but this taking as 20190732,20190733.... kindly help me to solve this (3 Replies)
Discussion started by: prathaban
3 Replies

2. Shell Programming and Scripting

Need to zip the files date wise --urgent Help needed

Hi all, this is my first post, i need to write a script to zip the files with datewise below are the log files. -rw------- 1 root sso 85316156 May 24 22:11 core_test_smservaz_104_104_1243217459_8896 -rw------- 1 root sso 90413304 May 25 22:12 core_test_smservaz_104_104_1243303895_20912... (4 Replies)
Discussion started by: lcschandu
4 Replies

3. Linux

date subtraction(URGENT)

Hi all, I need the date subtraction fuctionality using shell commands. For example: date1:Wed Apr 5 08:35:21 IST 2006 date2:Tue Apr 4 10:35:44 IST 2006 I need the date subtraction result like " 22 hours 23 seconds". Please guide me to complete this task. Can you please help me ASAP. ... (3 Replies)
Discussion started by: uday123
3 Replies

4. Shell Programming and Scripting

date arthemetic - really urgent

I get the timestamp of a file. the output of the timestamp is like this: Nov 3 11:04 I need to get the current date and subtract it from the timestamp. the output of the difference should be in minutes.. eg) (current_date-timestamp = x minutes) pls help guys.. thanks in advance (6 Replies)
Discussion started by: ragha81
6 Replies

5. AIX

URGENT --problem in unzipping

when try to unzip a very big file facing an error of disk full. can any body help me to unzip this file . $ unzip abc.zip Archive: abc.zip inflating: abc.zrp abc.zip write error (disk full?). Continue? (y/n/^C) $ n Thanks & Regards (2 Replies)
Discussion started by: suman_jakkula
2 Replies

6. Shell Programming and Scripting

problem in unzipping---URGENT

when try to unzip a very big file facing an error of disk full. can any body help me to unzip this file . $ unzip abc.zip Archive: abc.zip inflating: abc.zrp abc.zip write error (disk full?). Continue? (y/n/^C) $ n Thanks & Regards (1 Reply)
Discussion started by: suman_jakkula
1 Replies

7. HP-UX

Urgent printing problem

I can no longer print from HP-UX 10. All the printers are network printers. I have already stopped and restarted the spooler (lpshut and lpsched), but still the same problem. The printers react when I ping them. I have also tried with SAM, but the system cannot find the printers. Can somebody... (1 Reply)
Discussion started by: filipd
1 Replies

8. Solaris

Another Urgent HDD problem

I have another Hdd problem with Ultra 1 machine the hdd is segate (+-)17560 MB and when I start installtion of sun solaries 2.6 the system sees the hdd correctly, and the installtion goes fine with partioning the disk as follows / 150 MB swap 500 MB /user 1000 MB /user1 100MB /usr3 5500 MB... (4 Replies)
Discussion started by: adol3
4 Replies

9. UNIX for Dummies Questions & Answers

help urgent problem

i accedently "deleted" all workspaces I have a black screen and dont know what to do solaris common desktop enviroment (1 Reply)
Discussion started by: ssshakir
1 Replies

10. UNIX for Advanced & Expert Users

ulimit problem(Urgent)

Hi all, In Tru64 UNIX,there is a command ulimit which sets or reports a resource limit. -d option specifies number of Kilobytes for data area. But when i give same man ulimit in HP-UX, it does shows some ulimit function. I want to replace ulimit -d command in .profile file which... (1 Reply)
Discussion started by: informshilpa
1 Replies
Login or Register to Ask a Question