• 5
name
name Punditsdkoslkdosdkoskdo

Shell script time output over java enviroment

I am running a script from java program using sshxcute API. Script contains:

#!/bin/sh
data=`stat -c%y filename`
echo $data

Script running on bash gives output:

2014-03-08 13:26:29.335545828 -0800

Script running through java program gives output:

2014-03-08 21:26:29.335545828 +0000

I think the -0800 is getting added. I need output in first format. Anyone have any idea how to resolve the issue?

      • 1
    • At that time too, you were told in the comments that it's the time zone. Moreover, at that time, your question had only the first part. Refer to help on how to ask a good question. If you don't provide adequate information in the first instance, chances are that your question wouldn't attract answers.
      • 1
    • How are you running those programs exactly? Post your code. Is the TZ environment variable defined at any point (whether it's by your code or not — do echo $TZ from the shell script)?

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions