Solved

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

Posted on 2015-01-05
4
235 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 166 total points
Comment Utility
probably daylight savings time.
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 167 total points
Comment Utility
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 37

Accepted Solution

by:
Gerwin Jansen earned 167 total points
Comment Utility
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
Comment Utility
Someone solved this issue at the office without telling how :S
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 …
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now