how do you change the time format from 24_hour to 12_hour


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how do you change the time format from 24_hour to 12_hour
# 1  
Old 06-04-2002
Question how do you change the time format from 24_hour to 12_hour

Hello there!!!

I need to change the time format on a Unix development box running Sun OS 5.7 from military time to 12_hour.

Thanks
# 2  
Old 06-04-2002
you can modify

/usr/bin/date [-u] [[mmdd]HHMM | mmddHHMM[cc]yy][.SS]

HH will be the hour number format of 24hours and 12 hours. Give a try, Do post back the results.
# 3  
Old 06-05-2002
No no no... don't change the time...
RTFM - read the f(ine?) manual..

Every date man page I have seen lists options for formatting output of the date command.
For example, on a Linux system you could do this:
date +%r

Read your man page though - that's not necessarily portable.
# 4  
Old 06-06-2002
Thanks for the input.

I agree. I will be using mm/dd/yy %r + format

I found this by doing a man strf time.

Thanks for your prompt response
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calculate Time diff in milli milliseconds(Time format : HH:MM:SS,NNN)

Hi All, I have one file which contains time for request and response. I want to calculate time difference in milliseconds for each line. This file can contain 10K lines. Sample file with 4 lines. for first line. Request Time: 15:23:45,255 Response Time: 15:23:45,258 Time diff... (6 Replies)
Discussion started by: Raza Ali
6 Replies

2. Solaris

How to change time format in Solaris-10?

Hi, I want to change time format to AM/PM format. In below output - -bash-3.2# date Thu Jul 27 16:48:59 PDT 2017 -bash-3.2# I want to be it 4:48:59 PM. NTP is configured on this. Can time format be changed while NTP server is configured ? Thanks (3 Replies)
Discussion started by: solaris_1977
3 Replies

3. 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

4. Shell Programming and Scripting

Change name format

I am trying to use either awk or sed to make names like J. A. Smith and J.A. Martin Smith become JA Smith and JA Martin SmithThe code should concatenate abbreviated letters that have a dot after them. I have only been able to do this: echo $name | sed 's/\.\ //g'But that concatenates the... (3 Replies)
Discussion started by: locoroco
3 Replies

5. Shell Programming and Scripting

Format change

I wish to convert the following in shell. Help me SED or AWK ID= 12345,23456,67859 , 90225 , 67583 I can extract the right hand side of "=" using cut command "cut -d "=" -f2 after extracting that right side i would need like this '12345','23456','67859','90225','67583' 1 ) the... (2 Replies)
Discussion started by: ilugopal
2 Replies

6. Shell Programming and Scripting

format change

I have a text file sample.txt which contains some details like Order 9001 Item Code 34 Quantity 4 Entry Date 2009-04-23 Ordered by Ram Order 9002 Item Code 34 Quantity 3 (1 Reply)
Discussion started by: lazydev
1 Replies

7. OS X (Apple)

how to change date and time format in menu bar

Can someone please tell me how to change the time and date format in the menu bar. I get to System Preferences -- Language and Text, format, customize, but I can't figure out what to do next. I want to change, say from Tue May 4 to 5 4 2010. How the heck do I do this? (5 Replies)
Discussion started by: Straitsfan
5 Replies

8. 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

9. Shell Programming and Scripting

How to Change the Format of a Date

Hi All, this is my second post, last post reply was very helpful. I have a data that has date in DD/MM/YYYY (07/11/2008) format i want to replace the backslash by a dot(.) so that my awk script can read it inside the C shell script that i have written. i want to change 07/11/2008 to... (3 Replies)
Discussion started by: asirohi
3 Replies

10. Shell Programming and Scripting

change the empty function from the old format to the new format

I have about 300 files which has the function getDBBackend(). How to write a program to change the empty function from the old format to the new format? Old empty function format are either: function getDBBackend() { // Not available } // getDBBackend or: function... (0 Replies)
Discussion started by: powah
0 Replies
Login or Register to Ask a Question