How can i convert linux “date +%s” output to a more readable format in bash script

Here is the script:

#!/bin/bash

i="0"
startTime=`date -u +%s`
startTime=$[$startTime+$1+5]
echo ""
echo "##################"
echo "LAUNCHING REQUESTS"
echo "  COUNT:  $1 "
echo "  DELAY:  1 "
echo "  EXECUTION:  $startTime "
echo "##################"
echo ""

while [ $1 -gt "$i" ]
do
  i=$[$i+1]
  php avtestTimed.php $1 $2 $startTime &
  echo "QUEUEING REQUEST $i"
  sleep 1
done



so i want to convert $startTime into a UTC format

Answers


Try:

date -d @$(($startTime-$1-5))

if you want to decode the first state of $startTime variable, or this:

date -d @$startTime

and, you can add -u argument to get the UTC time... %)

read the man date


Need Your Help

Eclipse marks lines as dead code

java eclipse dead-code

I have this function with some dead code, marked by Eclipse.

How do I view the 8086 machine code of C and assembly programs?

c 8086 machine-code

I have a program in 8086 and C languages now i want to compare the machine code of each program. How can I get machine code of C and assembly 8086 code

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.