Solved

Convert date format in BASH

Posted on 2014-02-10
2
1,011 Views
Last Modified: 2014-02-10
Hi,

On RHEL 5.10

I'm looking for a way to convert date format.
for exmple from this: 10-FEB-2014/13:12
to this:                          20140210-1312
0
Comment
Question by:peledc
2 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 100 total points
ID: 39847248
Try
DATE=$(echo 10-FEB-2014/13:12 | sed 's/[-\/]/ /g')
date -d "$DATE" +"%Y%m%d-%H%M"

Open in new window

0
 
LVL 6

Expert Comment

by:Shiju Jacob
ID: 39847258
date  +"%Y%m%d-%H%M"
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

864 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now