Sponsored Content
Operating Systems HP-UX DATE and TIME format help in HP-UX Post 302718603 by pamu on Saturday 20th of October 2012 05:42:16 AM
Old 10-20-2012
Quote:
Originally Posted by Elavarasan
but i will have old date and time that need to be convert to another format as shown in my first thread....
Check if -d option is present or not..?

Code:
$date -d "Fri, Sep 12, 2012 08:38:05 PM" "+%Y-%m-%d %H:%M:%S"
2012-09-12 20:38:05

Or

Code:
date --date="Fri, Sep 12, 2012 08:38:05 PM" "+%Y-%m-%d %H:%M:%S"


Last edited by pamu; 10-20-2012 at 06:55 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

format date/time presentation

1) i am trying to print the timeframe of a log file using the start/end date/time being extracted from the file itself. my problem is how to convert the following numeric date format to the one that i prefer: Start time: 0204161129 End time : 0204171431 into: Start time: Apr 16 2002... (6 Replies)
Discussion started by: apalex
6 Replies

2. Shell Programming and Scripting

Convert Epoch time format to normal date time format in the same file

I have a file named "suspected" with series of line like these : {'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''} {'protocol': 17, 'service': 'BitTorrent... (3 Replies)
Discussion started by: rk4k
3 Replies

3. Shell Programming and Scripting

Date and Time format

I want to append current date and time to a file name like filename_090920091210. If I use filename_`date +%d%m%Y%T`, the ouput is filename_0909200912:10:33. How to format this as filename_090920091210. Please let me know. Thanks in advance. (3 Replies)
Discussion started by: srimenon09
3 Replies

4. Shell Programming and Scripting

date and time in mm/dd/yyyy hh:mm format

Frens, I have a logfile which has got manier things in it and somewer in that file i have a date in mm/dd/yyyy hh:mm format.... I just need to get the date and time nothing else.... i have searched in this forum for it but got only date in mm-dd-yyyy format.. but i need to search for... (10 Replies)
Discussion started by: smarty86
10 Replies

5. Shell Programming and Scripting

awk & date time format

This gives: grep "qprt -o -dp -N 1 -P" printfile.log.1216 |awk '{print $7, $9}' |grep lpc1z The output like below: lpc1z /cerner/d_prod/print/ccltemp4235396d030a.dat.tmp.1216075330] lpc1z /cerner/d_prod/print/ccltemp4235396d036a.dat.tmp.1216075634] lpc1z... (2 Replies)
Discussion started by: Daniel Gate
2 Replies

6. UNIX for Dummies Questions & Answers

Shell Scripts - shows today’s date and time in a better format than ‘date’ (Uses positional paramete

Hello, I am trying to show today's date and time in a better format than ‘date' (Using positional parameters). I found a command mktime and am wondering if this is the best command to use or will this also show me the time elapse since 1/30/70? Any help would be greatly appreciated, Thanks... (3 Replies)
Discussion started by: citizencro
3 Replies

7. Shell Programming and Scripting

Military type format date/time conversion

Hello All, I have a requirement to convert a 12 hour format to 24 hour time format and the sample input /out put is below Input Time format : Nov 2 2011 12:16AM Out Put Format : Nov 2 2011 0:16 Input : Nov 2 2011 4:16PM Out Put: Nov 2 2011 16:16 I have done this using a... (6 Replies)
Discussion started by: jambesh
6 Replies

8. Shell Programming and Scripting

Change the date and time format in UNIX script.

Hi, I am extracting a date string from the source file like this : 06/05/2014 16:04:00 I want to change it to 05-JUN-14 04.05.00.000000000 PM I basically store the date in a variable. I got solutions to change date in dd-mmm-yyyy format using tr but I guess it works only with the "date"... (8 Replies)
Discussion started by: Varshha
8 Replies

9. UNIX for Dummies Questions & Answers

How to chnage format and subtract time and date and get average.?

Hello All , Please support for below request how to change format and subtract time and date and get average. xxx 13-OCT-15 11.32.18.241000 AM 13-OCT-15 11.35.49.089080 AM xxx 13-OCT-15 11.32.24.000000 AM 13-OCT-15 11.45.17.810904 AM xxx 13-OCT-15 11.32.25.232000 AM ... (1 Reply)
Discussion started by: mirwasim
1 Replies

10. Shell Programming and Scripting

Valid separator in time and date format

Hello. I can use any particular (stupid or not) format when using bash date command. Example : ~> date --date "now" '+%Y-%m-%d %H!%M!%S' 2019-06-03 12!55!33or ~> date --date "now" '+%Y£%m£%d %H¤%M¤%S' 2019£06£03 12¤57¤36 or ~> date --date "now" '+%Y-%m-%d %H-%M-%S' 2019-06-03 12-58-51 ... (4 Replies)
Discussion started by: jcdole
4 Replies
CONVDATE(1)						      General Commands Manual						       CONVDATE(1)

NAME
convdate - convert time/date strings and numbers SYNOPSIS
convdate [ -c ] [ -n ] [ -s ] arg... DESCRIPTION
Convdate translate the date/time strings specified as arguments on its command line, outputting the results one to a line. OPTIONS
-c If the ``-c'' flag is used, then each argument is taken to be a time_t and is output in ctime format. -n If the ``-n'' flag is used, then each argument is taken as a date string to be parsed by parsedate(3) and is output as a time_t; see time(2). -s If the ``-s'' flag is used, then each argument is taken as a date string to be parsed by parsedate(3) and is output as a string for- matted by ctime(3). This is the default. EXAMPLES
% convdate 'feb 10 10am' Sun Feb 10 10:00:00 1991 % convdate 12pm 5/4/90 Fri Dec 13 00:00:00 1991 Fri May 4 00:00:00 1990 % convdate -n 'feb 10 10am' '12pm 5/4/90' 666198000 641880000 % convdate -c 666198000 Sun Feb 10 10:00:00 1991 HISTORY
Written by Rich $alz <rsalz@uunet.uu.net>. This is revision 1.2, dated 1998/05/20. SEE ALSO
parsedate(3). CONVDATE(1)
All times are GMT -4. The time now is 03:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy