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 8849853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:45:42+00:00 2026-06-14T12:45:42+00:00

I need to get three dates in variables Today Since Midnight which I have

  • 0

I need to get three dates in variables

Today Since Midnight which I have as

t = Time.now.strftime(“%Y-%m-%d 00:00:01”) # 2012-11-19 00:00:01

Yesterday Since Midnight (i.e. 00:00:00 to 23:59:59)

y1 = 2012-11-18 00:00:01
y2 = 2012-11-19 23:59:59

it is specifically the y1 & y2 variables I need to create as strings for use in a gem. being new to ruby I am a little confused as Time.yesterday doesn’t seem to do what I need

EDIT

For this be sure to include

require ‘active_support/all’

and ensure the gem is bundled for your application.

Used:

@current   = (Time.now).beginning_of_day.utc.strftime("%Y-%m-%d")
@yesterday = (Time.now - 1.day).beginning_of_day.utc.strftime("%Y-%m-%d")
@everything = (Time.now - 2.day).end_of_day.utc.strftime("%Y-%m-%d")
  • 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-06-14T12:45:44+00:00Added an answer on June 14, 2026 at 12:45 pm

    You can do,

     t=Time.now
     y1=t-1.day
     y2=t+1.day
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sending an email, and to send it I need to get three
Hi There I need to get the names and values of checkboxes that have
I need get the id of an images which is place inside a datatemplate..
I need get all items these have no categories int? categoryId = null; var
I have this string: tag:domain.com,2012-10-12:feed/channel/id/335 Im trying to get the last digits from this
How do I get today's date in C# in mm/dd/yyyy format? I need to
I need to get the subscriber count/list of a Youtube user, is there any
There's a strange requirement where I need to get server side data on page
is there anything special I need to do to get ASP.NET MVC3 enabled on
Is there a way to get the size at runtime ? I need to

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.