08-19-2008
Quote:
Originally Posted by
palsevlohit_123
timehh=`date -u '+%H'`
timemm=`date -u '+%M'`
curr_time="$timehh:$timemm"
timemm=`expr $timemm + 1`
new_time="$timehh:$timemm"
echo "$curr_time === $new_time"
this won't work if current time is 12:59 and so on.. because after addition it becomes 12:60 instead of 13:00
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have a file that looks like the following:
Name1 aaa bbbb
Name1 ffd hhghg
Name1 dffg ghhhh
Name2 rtrt dfff
Name2 rrtfr tgtt
Name2 dsddf gfggf
Name2 ffffg gfgf
NAme3 fdff ghhgh
Is it possible to format it so that a number... (2 Replies)
Discussion started by: azekry
2 Replies
2. Shell Programming and Scripting
How would you convert lets say a 1000 minutes to hours, minutes, seconds (1 Reply)
Discussion started by: Vozx
1 Replies
3. Shell Programming and Scripting
Hi All,
I have created a script...
#!/bin/sh
datafile=ABC2008101601.OUT
indfile=ABCIND20081016.1.OUT
waittime=600
starttime=0
while
do
if
then
echo "Indicator file has arrived."
break
else
sleep 10;
((starttime=$starttime+10))
echo $starttime (2 Replies)
Discussion started by: Amit.Sagpariya
2 Replies
4. Shell Programming and Scripting
Hi,
New to scripting.
I have datetime as a String and I need to add some hours/minutes in to that.
21/10/2009 23:00:00
After adding 180 minutes; it will look like this
22/10/2009 02:00:00
Regards,
Vikas Mahajan (9 Replies)
Discussion started by: vikas482
9 Replies
5. Shell Programming and Scripting
Dear all, today I'm scratching my head with a simple (I believe) issue.
Working with date is quite simple, so if I Need to add some seconds to current time, I'll use:
date --date='+30 seconds' +"%Y-%m-%d %H:%M:%S"But, how to pass the value to add from a variable? I tried the following without... (2 Replies)
Discussion started by: Lord Spectre
2 Replies
6. Shell Programming and Scripting
Hi All,
I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies
7. Shell Programming and Scripting
Hello All,
I am working on script where I need to add hours,minutes or seconds in the time.Time is not the current but it could be future time.I thought I can store that time in variable and add hours.minutes or second but I am not able to add that in the time that is stores in a variable.
Time... (9 Replies)
Discussion started by: anuragpgtgerman
9 Replies
8. UNIX for Beginners Questions & Answers
Hi, please help with below time conversion to minutes.
one column values:
2 minutes 16 seconds 420 msec
43 seconds 750 msec
0 days 3 hours 29 minutes 58 seconds 480 msec
11 seconds 150 msec
I need output in minutes(total elapsed time in minutes) (2 Replies)
Discussion started by: ramu.badugula
2 Replies
9. Shell Programming and Scripting
Hi all,
System Ubuntu 16.04.3 LTS
i have the following log
INFO 2019-02-07 15:13:31,099 module.py:700] default: "POST /join/8550614e-3e94-4fa5-9ab2-135eefa69c1b HTTP/1.0" 500 2042
INFO 2019-02-07 15:13:31,569 module.py:700] default: "POST /join/6cb9c452-dcb1-45f3-bcca-e33f5d450105... (15 Replies)
Discussion started by: charli1
15 Replies
10. Shell Programming and Scripting
Hello all,
Info:
System RedHat 7.5
I need to create a script that based on the creation time,
if the file is older then 5 minutes then execute some stuff, if not exit.
I thought to get the creation time and minutes like this.
CreationTime=$(stat -c %y /tmp/test.log | awk -F" " '{ print... (3 Replies)
Discussion started by: charli1
3 Replies
LEARN ABOUT PHP
datetime.format
DATETIME.FORMAT(3) 1 DATETIME.FORMAT(3)
DateTime::format - Returns date formatted according to given format
Object oriented style
SYNOPSIS
public string DateTime::format (string $format)
DESCRIPTION
string DateTimeImmutable::format (string $format) string DateTimeInterface::format (string $format)
Procedural style
string date_format (DateTimeInterface $object, string $format)
Returns date formatted according to given format.
PARAMETERS
o $object
-Procedural style only: A DateTime object returned by date_create(3)
o $format
- Format accepted by date(3).
RETURN VALUES
Returns the formatted date string on success or FALSE on failure.
EXAMPLES
Example #1
DateTime.format(3) example
Object oriented style
<?php
$date = new DateTime('2000-01-01');
echo $date->format('Y-m-d H:i:s');
?>
Procedural style
<?php
$date = date_create('2000-01-01');
echo date_format($date, 'Y-m-d H:i:s');
?>
The above example will output:
2000-01-01 00:00:00
NOTES
This method does not use locales. All output is in English.
SEE ALSO
date(3).
PHP Documentation Group DATETIME.FORMAT(3)