Sponsored Content
Top Forums UNIX for Dummies Questions & Answers an hour less in 24 hour system Post 302093775 by bobo on Monday 23rd of October 2006 11:43:44 AM
Old 10-23-2006
Data an hour less in 24 hour system

My program:

__________________________________

#!/bin/ksh

DAY=`date +%y%m%d`
H=`date +%H`
M=`date +%M`
day=`date +%m/%d/%y`
let h=$H-1
echo DAY $DAY
echo H $H
echo M $M
echo day $day
echo h $h

_____________________________________

My result:

______________________________________

DAY 061023
H 09
M 38
day 10/23/06
h 8

_______________________________________


My need help:


on the "let h=$H-1" I have the result of number 8; how can I make it 08 ( have the zero in front of 8)


please help
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

record wc -l over 24 hour period

I need to keep track of this output echo "dis chs(*)" | runmqsc | grep RUNNING | wc -l I need to record that count once an hour 24 hours a day and write to a file with the date and time it was run. Any idea on how to do this. (5 Replies)
Discussion started by: csaunders
5 Replies

2. UNIX for Dummies Questions & Answers

1 Hour less

set DAY=`date +%y%m%d` set H=`date +%H` set M=`date +%M` mailx -s "$H-Mydata" myemail@mail.com<mydata I am looking to set the current hour to have 1 hour less in the subject header: For example: let's say the system time is 8 I want to have "7-Mydata" not "8-Mydata" Can some1... (6 Replies)
Discussion started by: bobo
6 Replies

3. AIX

AIX 5.3 12 Hour System Clock

Hello Everyone, I have a Domino application running on AIX 5.3 that does time conversions worldwide. It uses the operating system time as a reference for the conversion. My problem is that I need the AIX OS clock to be a 12 hour clock (AM/PM) rather than a 24 hour clock. I have tried the date... (2 Replies)
Discussion started by: RTwitchell
2 Replies

4. Shell Programming and Scripting

help in hour grep

i have this script that checks for yesterday date and also specific hour in that ----------------------------------------------------------------- TZ=`date +%Z`+24 ;a=`date +%Y-%m-%d %k` cd logs count=0 for i in DBMaint.log do cat $i | grep $a >> file12.txt done... (0 Replies)
Discussion started by: ali560045
0 Replies

5. Linux

my server is 1 hour behind after DST

Hello, I have linux server which is one hour behind after the DST change last week. I post some information below on the settings. any helpwould be helpful since I am newbie.. $ clock Tue 04 Nov 2008 03:12:26 PM EST -0.785549 seconds $more clock Tue 04 Nov 2008 03:12:26 PM EST... (2 Replies)
Discussion started by: jbdavis02@yahoo
2 Replies

6. What is on Your Mind?

Power Hour?

I had some free time at work today so I decided to get a little practice with my shell scripts (I'm pretty new to the whole UNIX thing). I'm sure I'm not the only college student here so maybe this code will come in handy for future weekends. #!/bin/sh if then echo "No playlist... (0 Replies)
Discussion started by: thedoobieman5
0 Replies

7. Shell Programming and Scripting

Getting the last hour from a log.

I have a log like this: Jan 26 13:59:41 server2 ntpdate: step time server 91.189.94.4 offset 0.065456 sec Jan 26 13:59:41 server2 ntpd: ntpd 4.2.4p8@1.1612-o Fri Aug 6 22:49:54 UTC 2010 (1) Jan 26 13:59:41 server2 ntpd: precision = 1.000 usec Jan 26 13:59:41 server2 ntpd: ntp_io: estimated max... (2 Replies)
Discussion started by: Jotne
2 Replies

8. Shell Programming and Scripting

How to convert 24 hour time to 12 hour timing?

Hi friends, I want to convert 24 hour timing to 12 hour please help me... my data file looks like this.. 13-Nov-2011 13:27:36 15.32044 72.68502 13-Nov-2011 12:08:31 15.31291 72.69807 16-Nov-2011 01:16:54 15.30844 72.74028 15-Nov-2011 20:09:25 15.35096 ... (13 Replies)
Discussion started by: nex_asp
13 Replies

9. Shell Programming and Scripting

How to get next hour?

Hi guys I want any script to get me next hour For example Nexthour.sh 2013022823 It get me result 2013030100 Thanks a lot , I'm using Solaris 10 (5 Replies)
Discussion started by: teefa
5 Replies

10. UNIX for Advanced & Expert Users

Want to get average value for each hour

I want to get CPU average value only (not required user CPU & memory) with each hours on individual date. The sample output is below | | | User |Memory| User | Date | Time |CPU %|CPU % | % |Mem % | 03/02/2015|00:00:00| 24.56| 20.66| 89.75| 63.48|... (13 Replies)
Discussion started by: Saravanan_0074
13 Replies
PX_TIMESTAMP2STRING(3)													    PX_TIMESTAMP2STRING(3)

px_timestamp2string - Converts the timestamp into a string.

SYNOPSIS
string px_timestamp2string (resource $pxdoc, float $value, string $format) DESCRIPTION
Turns a timestamp as it stored in the paradox file into human readable format. Paradox timestamps are the number of miliseconds since 0001-01-02. This function is just for convenience. It can be easily replaced by some math and the calendar functions as demonstrated in the following example. PARAMETERS
o $pxdoc - Resource identifier of the paradox database. o $value - Value as stored in paradox database field of type PX_FIELD_TIME, or PX_FIELD_TIMESTAMP. o $format - String format similar to the format used by date(3). The placeholders support by this function is a subset of those supported by date(3) (Y, y, m, n, d, j, H, h, G, g, i, s, A, a, L). RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Turn a paradox timestamp into a human readable form <?php $px = px_new(); /* make up a date as it could be stored in */ /* a date field of a paradox db. */ /* 700000 days since 1.1.0000. */ $days = 700000; /* Use the calendar functions to print a */ /* human readable format of the date */ echo jdtogregorian($days+1721425)." "; /* Turn it into a timestamp as it stored in a paradox database */ /* Timestamps are stored in miliseconds since 0001-01-02 */ $stamp = $days * 86400.0 * 1000.0; /* Add one hour */ $stamp += 3600000.0; /* The following will output '7/15/1917 01:00:00'. */ echo px_timestamp2string($px, $stamp, "n/d/Y H:i:s")." "; px_delete($px); ?> The above example will output: 7/15/1917 7/15/1917 01:00:00 The Julian day count as passed to jdtogregorian(3) has a different base of 1.1.4714 b.c. and must therefore be calculated by adding 1721425 to the day count used in the paradox file. Turning the day count into a timestamp is easily done by multiplying with 86400000.0 to obtain miliseconds. SEE ALSO
px_date2string(3), jdtogregorian(3). PHP Documentation Group PX_TIMESTAMP2STRING(3)
All times are GMT -4. The time now is 12:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy