ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41317] - Ant tstamp returns GMT when Server Time is CST
Date Mon, 08 Jan 2007 17:00:20 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41317>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41317


peterreilly@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From peterreilly@apache.org  2007-01-08 09:00 -------
Ant does nothing special, it just uses the JVM.
For example:

src/ShowTime.java:

import java.text.SimpleDateFormat;
import java.util.Date;
public class ShowTime {
    public static void main(String[] args) throws Exception {
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd HHmm");
        Date d = new Date();
        System.out.println("The time is now: " + format.format(d));
    }
}

and build.xml
project>
  <mkdir dir="classes"/>
  <javac srcdir="src" destdir="classes"
         debug="yes"/>
  <java classname="ShowTime" classpath="classes"/>
  <tstamp/>
  <echo>The time is now: ${DSTAMP} ${TSTAMP}</echo>
</project>
Should give the same string.
The changes made to the server must have confused the JVM,
so it started to use the default time zone - GMT.

You can tell the tstamp task to use a specific timezone
by having a nested <format> element.

  <tstamp>
    <format property="TODAY_CST" pattern="yyyyMMdd HHmm" timezone="CST"/>
  </tstamp>
  <echo>The time is now: ${TODAY_CST}</echo>

But this is not a general solution.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message