Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Script "date" command returning one hour less than system time

Posted on 2015-01-05
4
Medium Priority
?
286 Views
Last Modified: 2015-01-06
I have some script in unix that executes "date" command in it, its very weird, the "date" time returned by the script is one hour less than the same command executed directly on the system. What can be going on here??
0
Comment
Question by:celtician
4 Comments
 
LVL 24

Assisted Solution

by:mankowitz
mankowitz earned 664 total points
ID: 40532033
probably daylight savings time.
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 668 total points
ID: 40532035
Which options/switches do you use for the "date" commands?

Does the script set or change the timezone?
Run "echo $TZ"  from the command line and from the script to check.
Contrast with "date +%z" run from the script and from the command line.
0
 
LVL 38

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 668 total points
ID: 40532480
Without posting (parts of) your script that determine the date/time everything is possible,

TZ setting (environment or script), getting timestamp from a file (-r), excuting the date command on a remote machine etc.

Can you post your script or at least the parts that handle date/time?
0
 

Author Comment

by:celtician
ID: 40533567
Someone solved this issue at the office without telling how :S
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question