How to change time format in Solaris-10?


 
Thread Tools Search this Thread
Operating Systems Solaris How to change time format in Solaris-10?
# 1  
Old 07-27-2017
How to change time format in Solaris-10?

Hi,
I want to change time format to AM/PM format. In below output -
Code:
-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
# 2  
Old 07-28-2017
Have you looked at the options for the date command? You can build almost any format you can think of with the options there. Are there certain options that are not working for you? As an example, you could:-
Code:
date '+%Y%m%d%H%M%S'          # Output in a sortable format, yet still obvious to a human reader
date '+%s'                    # Number of seconds since the Epoch

NTP is not a problem for you. The NTP process manages the system clock, which is not what you see when you use the date command. The system clock is held in seconds from the epoch (or parts of) and the date command reads the system clock, displaying it according to your defined time zone in the format you have specified, or the default if you do not set one. Although the date command reads (or writes) the clock, there is no active relationship between them.




Robin

Last edited by rbatte1; 07-28-2017 at 05:04 AM.. Reason: Comments about NTP
# 3  
Old 07-28-2017
To add to what Robin already said: time is stored in UNIX systems not in a certain format, but a number: the so-called "UNIX time", which counts the seconds since Midnight Jan 1st, 1970. As the time of writing this number is: 1501232481.

Whatever output the date-command (and the system calls it implements) delivers, it is always this number, calculated into a date and then formatted somehow. Therefore a "UNIX-date-format" doesn't exist: the date information is always formatted on the fly to the respective specification (like, as Robin said, the option to the date-command).

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 4  
Old 07-28-2017
Thanks. I did some more digging and found "LC_TIME=en_US.ISO8859-1" was set in profile, which was converting format.
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

Solaris 10 Sparc. How to change Vendor info of SAN disks reported in "format" command?

Greetings! After block level migration using an external appliance, the luns are getting reported as DGC-RAID5 and these luns are infact from the new storage. I have a query on changing the device Vendor info from DGC-RAID5 to HP3par in the format o/p only. AVAILABLE DISK SELECTIONS: ... (3 Replies)
Discussion started by: n_Bhaskar
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. Solaris

Change date format in solaris 10

Hi We have upgraded our sun machine from solaris 9 to solaris 10. Before upgradation the date command output(Solaris 9) Wed Oct 13 09:45:21 IST 2010 But after upgradation the output for date is as below(solaris 10). Wednesday, October 13, 2010 9:46:14 AM IST Looks like I need to... (1 Reply)
Discussion started by: csreenivas
1 Replies

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

6. Solaris

How to change Solaris cluster time?

Hi friends, In our cluster some time difference is there. User told me to change into IST time. How can i change the time in a cluster 3.0. please help me. thanks to all (1 Reply)
Discussion started by: sijocg
1 Replies

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

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

9. Solaris

Time change next week - solaris 8 ?

Can anyone tell me does solaris 8 automatically update the time upon the daylight savings? (4 Replies)
Discussion started by: frustrated1
4 Replies

10. UNIX for Dummies Questions & Answers

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 (3 Replies)
Discussion started by: young_too
3 Replies
Login or Register to Ask a Question