Sponsored Content
Top Forums Shell Programming and Scripting Can anyone help me to print UNIX epoch time to days,hours,min,sec ? Post 302956861 by hergp on Monday 5th of October 2015 03:55:59 AM
Old 10-05-2015
You probably mean the korn shell. If you have the korn shell 93 on your system, you can use
Code:
$ printf "%(%Y-%m-%d %T)T\n" '#1443929685'
2015-10-04 05:34:45

This requires the printf builtin function, which is activated by default in ksh93, not /usr/bin/printf. By changing the format string in the printf statement you can easily change the output format.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add data in days:hours:min:sec format

I want to add these no. these are in the format of days:hours:minutes:sec I want result in this format only 0:00:04:59 0:00:00:12 0:00:00:28 0:00:00:03 0:01:29:35 0:00:00:19 0:01:05:21 Is any body ca help me????? To get This.. Thanks Nishant (1 Reply)
Discussion started by: krishna_sicsr
1 Replies

2. Shell Programming and Scripting

Convert Epoch Time to Standard Date and Time & Vice Versa

Hi guys, I know that this topic has been discuss numerous times, and I have search the net and this forum for it. However, non able to address the problem I faced so far. I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Discussion started by: DrivesMeCrazy
5 Replies

3. Shell Programming and Scripting

How to calculate unix epoch time with DC(Calculator)

Hi All, In our code we are using below code to calculate the UNIX Epoch Time from the time stamp present in the file. Can any one explain how the DC operates in below command and how we calculate the UNIX EPOCH time from this. Date incide the file is 20:26:51 Output we get is 1289943554... (3 Replies)
Discussion started by: mithunpatel
3 Replies

4. UNIX for Dummies Questions & Answers

Capture running process for 2 hours with an interval of 10 sec

Hi, Can any one help me on this. How to capture the running process for two hours with an interval of 10 sec. Thanks in andvance Double post, continued here, thread closed (0 Replies)
Discussion started by: sarathkumar
0 Replies

5. Shell Programming and Scripting

Capture running process or 2 hours with an interval of 10 sec

Hi, Can any one help me on this. How to capture the running process for two hours with an interval of 10 sec. Thanks in andvance (1 Reply)
Discussion started by: sarathkumar
1 Replies

6. Shell Programming and Scripting

Shell script to convert epoch time to real time

Dear experts, I have an epoch time input file such as : - 1302451209564 1302483698948 1302485231072 1302490805383 1302519244700 1302492787481 1302505299145 1302506557022 1302532112140 1302501033105 1302511536485 1302512669550 I need the epoch time above to be converted into real... (4 Replies)
Discussion started by: aismann
4 Replies

7. Shell Programming and Scripting

Adding Seconds to UNIX/Epoch-Time

Hello All, I have a Perl script I'm writing where I ask the user to enter a "start time" for something. The "$start_time" will be in the format of: # The Time CLI Option Can be in the format of: --start-time="1day" --start-time="2hours" --start-time="45min" ... (1 Reply)
Discussion started by: mrm5102
1 Replies

8. Shell Programming and Scripting

Get the no of hours between days

Hi, i have a date 1- 2013101511 date2 -2013101812 need toget the no of hours between them,can any one tellme the logic. (6 Replies)
Discussion started by: sandeep karna
6 Replies

9. Shell Programming and Scripting

Convert Second Column Date Into EPOCH Time And Print Complete Row

Hello Team, I am stuck in getting the required output in the following case. Please help. My input file is aa|08/01/2016 bb|08/15/2016 I wish to convert the file into aa|epoch time bb|epoch time I am using following code: (3 Replies)
Discussion started by: angshuman
3 Replies

10. Solaris

How to run cron entry every 5 min during office hours only?

Hi I need to setuop a cron entry to run every 5 min, only in office hours (between 8:00AM to 18:00PM, I did the following: 0,5,10,15,20,25,30,35,40,45,50,55 8,9,10,11,12,13,14,15,16,17,18 * * * /home/xxx/zzz.ksh But somehow does not work. Could it be wrong? (8 Replies)
Discussion started by: fretagi
8 Replies
PRINTF(1)							   User Commands							 PRINTF(1)

NAME
printf - format and print data SYNOPSIS
printf FORMAT [ARGUMENT]... printf OPTION DESCRIPTION
Print ARGUMENT(s) according to FORMAT, or execute according to OPTION: --help display this help and exit --version output version information and exit FORMAT controls the output as in C printf. Interpreted sequences are: " double quote \ backslash a alert (BEL)  backspace c produce no further output e escape f form feed new line carriage return horizontal tab v vertical tab NNN byte with octal value NNN (1 to 3 digits) xHH byte with hexadecimal value HH (1 to 2 digits) uHHHH Unicode (ISO/IEC 10646) character with hex value HHHH (4 digits) UHHHHHHHH Unicode character with hex value HHHHHHHH (8 digits) %% a single % %b ARGUMENT as a string with '' escapes interpreted, except that octal escapes are of the form or NNN %q ARGUMENT is printed in a format that can be reused as shell input, escaping non-printable characters with the proposed POSIX $'' syntax. and all C format specifications ending with one of diouxXfeEgGcs, with ARGUMENTs converted to proper type first. Variable widths are han- dled. NOTE: your shell may have its own version of printf, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports. AUTHOR
Written by David MacKenzie. REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report printf translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
printf(3) Full documentation at: <http://www.gnu.org/software/coreutils/printf> or available locally via: info '(coreutils) printf invocation' GNU coreutils 8.28 January 2018 PRINTF(1)
All times are GMT -4. The time now is 08:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy