You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Nicolas FRANK <nf...@financeactive.com> on 2003/07/16 16:32:40 UTC

RE : Getting current date/time?

You can use <tstamp/> (which is an ant tag). It set 2 properties DSTAMP and
TSTAMP with date and time (see ant documentation for more details)

Ex:

 <tstamp/>
 <property name="log.filename" value="log-${DSTAMP}.${TSTAMP}.log"/>


-----Message d'origine-----
De : James CE Johnson [mailto:jcej@tragus.org] 
Envoyé : mercredi 16 juillet 2003 16:27
À : users@maven.apache.org
Objet : Getting current date/time?


Hey all,

Is there any way for my maven.xml to fetch the current date/time so that I
can subsequently write (using <echo...) it to a file?

Thanks,
James


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: RE : Getting current date/time?

Posted by di...@multitask.com.au.
There's also a jelly format date tag too.

See 
http://jakarta.apache.org/commons/jelly/libs/fmt/tags.html#fmt:formatDate
--
dIon Gillard, Multitask Consulting
Blog:      http://blogs.codehaus.org/people/dion/
Work:      http://www.multitask.com.au


Andy Paul <ap...@blueyonder.co.uk> wrote on 17/07/2003 05:13:21 AM:

> James,
>     Just in case you're interested or want to do more formatting with 
> the date, I believe this is a Jellified
> version where you can set up the format...
>   <!-- create a Java Date instance for 'today' -->
>   <new var="now" className="java.util.Date"/>
> 
>     <!-- create a Java Date formatter -->
>   <new var="formatter" className="java.text.SimpleDateFormat">
>             <arg value="EEE dd/MM/yy"/>
>    <new>
> 
>   <!-- create a new jelly variable (xx) from the output of putting 
> the 
date through the formatter -->
>   <invoke var="xx" on="${formatter}" method="format">
>         <j:arg value="${now}"/>
>    </j:invoke>
> <!-- display the variable -->
>   The time according to jelly is ${xx}
> 
>     Regards
>           Andy
> 
> >>You can use <tstamp/> (which is an ant tag). It set 2 properties 
DSTAMP
> >>and TSTAMP with date and time (see ant documentation for more details)
> >>
> >>Ex:
> >>
> >> <tstamp/>
> >> <property name="log.filename" value="log-${DSTAMP}.${TSTAMP}.log"/>
> >> 
> >>
> >
> >Great! That's exactly what I was after and I just couldn't find it.
> >
> > 
> >
> >>-----Message d'origine-----
> >>De : James CE Johnson [mailto:jcej@tragus.org]
> >>Envoyé : mercredi 16 juillet 2003 16:27
> >>À : users@maven.apache.org
> >>Objet : Getting current date/time?
> >>
> >>
> >>Hey all,
> >>
> >>Is there any way for my maven.xml to fetch the current date/time so 
that
> >>I can subsequently write (using <echo...) it to a file?
> >>
> >>Thanks,
> >>James
> >>
> >> 
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> > 
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

Re: RE : Getting current date/time?

Posted by Andy Paul <ap...@blueyonder.co.uk>.
James,
    Just in case you're interested or want to do more formatting with 
the date, I believe this is a Jellified
version where you can set up the format...
  <!-- create a Java Date instance for 'today' -->
  <new var="now" className="java.util.Date"/>

    <!-- create a Java Date formatter -->
  <new var="formatter" className="java.text.SimpleDateFormat">
            <arg value="EEE dd/MM/yy"/>
   <new>

  <!-- create a new jelly variable (xx) from the output of putting the 
date through the formatter -->
  <invoke var="xx" on="${formatter}" method="format">
        <j:arg value="${now}"/>
   </j:invoke>
<!-- display the variable -->
  The time according to jelly is ${xx}

    Regards
          Andy

>>You can use <tstamp/> (which is an ant tag). It set 2 properties DSTAMP
>>and TSTAMP with date and time (see ant documentation for more details)
>>
>>Ex:
>>
>> <tstamp/>
>> <property name="log.filename" value="log-${DSTAMP}.${TSTAMP}.log"/>
>>    
>>
>
>Great! That's exactly what I was after and I just couldn't find it.
>
>  
>
>>-----Message d'origine-----
>>De : James CE Johnson [mailto:jcej@tragus.org]
>>Envoyé : mercredi 16 juillet 2003 16:27
>>À : users@maven.apache.org
>>Objet : Getting current date/time?
>>
>>
>>Hey all,
>>
>>Is there any way for my maven.xml to fetch the current date/time so that
>>I can subsequently write (using <echo...) it to a file?
>>
>>Thanks,
>>James
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>For additional commands, e-mail: users-help@maven.apache.org
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: RE : Getting current date/time?

Posted by James CE Johnson <jc...@tragus.org>.
> You can use <tstamp/> (which is an ant tag). It set 2 properties DSTAMP
> and TSTAMP with date and time (see ant documentation for more details)
>
> Ex:
>
>  <tstamp/>
>  <property name="log.filename" value="log-${DSTAMP}.${TSTAMP}.log"/>

Great! That's exactly what I was after and I just couldn't find it.

>
>
> -----Message d'origine-----
> De : James CE Johnson [mailto:jcej@tragus.org]
> Envoyé : mercredi 16 juillet 2003 16:27
> À : users@maven.apache.org
> Objet : Getting current date/time?
>
>
> Hey all,
>
> Is there any way for my maven.xml to fetch the current date/time so that
> I can subsequently write (using <echo...) it to a file?
>
> Thanks,
> James
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org