Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6143009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:27:56+00:00 2026-05-23T18:27:56+00:00

So why does this work: requestInstance.needByDate = new Date() + 4 requestInstance.needByDate.clearTime() But this

  • 0

So why does this work:

requestInstance.needByDate = new Date() + 4
requestInstance.needByDate.clearTime()

But this doesn’t ?

requestInstance.needByDate= (new Date() + 4).clearTime()

EDIT: as indicated below by Tim this is a bug in Groovy version: 1.7.9-SNAPSHOT (the one I am using of course)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:27:57+00:00Added an answer on May 23, 2026 at 6:27 pm

    I can’t get it to not work…

    needByDate = new Date() + 4
    needByDate.clearTime()
    println needByDate
    
    needByDate = (new Date() + 4).clearTime()
    println needByDate
    

    Run with Groovy 1.8 prints:

    Fri Jul 22 00:00:00 UTC 2011
    Fri Jul 22 00:00:00 UTC 2011
    

    What version of Groovy are you running? Maybe a previous version did not have clearTime returning a Date?

    Edit

    Yeah, found it. There was a bug reported that clearTime() should return a Date and it was fixed in Groovy 1.8.0 and 1.7.11

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why does this work: self.array = newArray; But this doesn't: [[self mutableArray] addObject:object]; Meaning,
Why does this work: List<?> list = new LinkedList<Integer>(); while this gives a type
Why does this work: ListItem item = new ListItem(); string value = lstAvailExtPropsToFilter.SelectedItem.Text +
Why does this work in design mode but not when I run it: <tr
I was always curious. Why does this work: double Number = Convert.ToDouble(TextBox1.Text); But this
Why does this work: $(form[data-remote].edit_item).submit(); But this does not? $(form[data-remote].edit_item).submit(function() { alert('goo') });
Why does this work for some people, and doesn't for others? Others just click
Why does this work: a = [] a.push(['test']); (function() {alert('poop')})() But this gives the
What does this work without a type? ArrayList l = new ArrayList(); Does it
Why does this work: //split returns (char**) char *temp2; temp2=split(array[i],'=')[1]; and this doesn't: char

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.