Solved

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

Posted on 2015-01-05
4
258 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 24

Assisted Solution

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

Assisted Solution

by:woolmilkporc
woolmilkporc earned 167 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 167 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:
Suggested Courses

621 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