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

  • SEARCH
  • Home
  • 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 8906077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:33:29+00:00 2026-06-15T02:33:29+00:00

I have a date which is coming from the form in American format (MM-DD-YYYY)

  • 0

I have a date which is coming from the form in American format (MM-DD-YYYY) and now i want to compare it with the date from the database which is in utc.
And therefore i have to convert that date to utc,I’m doing this but its not working:

from_date = Date.strptime(params[:from_date], '%m-%d-%Y').utc

It is giving me error

undefined method `utc' for Sat, 15 Dec 2012:Date
  • 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-15T02:33:30+00:00Added an answer on June 15, 2026 at 2:33 am

    The #utc method is only defined for Time objects. If timezones are important for what you are trying to do, try

    from_date = Date.strptime(params[:from_date], '%m-%d-%Y').to_time.utc
    

    Also look at the documentation: http://www.ruby-doc.org/core-1.9.3/Time.html#method-i-utc

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

Sidebar

Related Questions

I have a date coming in this format MM-DD-YYY from view and i want
I am have a string named begin_date which contain date in the format dd.mm.yyyy
I have a slight problem, I have a date format coming from php my
I have a Date format coming from API like this: start_time: 2015-10-1 3:00 PM
I have this data coming from a REST method using jquery's getJSON method. [Date.UTC(2010,0,0,0,0,0,0),
i have one table in my database say mytable, which contents request coming from
I have a Core Data class Meeting with a property date which I want
I want a Django model to have a date field in which the year,
I have a form which posts date information month, day, yeah, hour, minute, am/pm.
I am querying tables from Microsoft SQL 2008 which have date split across 3

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.