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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:02:42+00:00 2026-06-05T09:02:42+00:00

I have a tool set to store everything in the db as UTC. On

  • 0

I have a tool set to store everything in the db as UTC. On a form I have a text field with an attached jQuery Date + Time picker.

In that textfield the dateTime stamp (w/ UTC offset) will just appear like:

<%= f.text_field :report_time, :size => 22  %>
    2012-06-05 15:55:50

However I need this form choice to be in EST. So I need to convert it going to the form and then when the form is submitted. This problem is specific only to when an ‘EDIT’ action is taken (time already exists in field). If I do any addition or subtraction “UTC” gets stuck on the end in the form text field:

@report.report_time = @report.report_time - 5.hours
=>2012-06-05 10:55:50 UTC

At this point a jQuery DateJS dateparse function I’m using will stop working because it doesn’t understand the “UTC” text in the text field holding the dateTime.

How can I take a db UTC time and add/subtract hours without “UTC” getting dropped in the form, or how can you remove the UTC offest information leaving only the raw dateTime information?

How do I:

@report.report_time = @report.created_at - 5.hours
=>2012-06-05 10:55:50 UTC
#  do something here to strip " UTC" off the dateTime   ??
=>2012-06-05 10:55:50

Thank You!
Rails 2.3.5 / Ruby 1.8.7

  • 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-05T09:02:44+00:00Added an answer on June 5, 2026 at 9:02 am

    Use the strftime function to set the value of the field directly, if you don’t want the default representation.

    <%= f.text_field :report_time, :size => 22, :value =>"...." %>
    

    http://ruby-doc.org/stdlib-1.8.7/libdoc/date/rdoc/DateTime.html#method-i-strftime

    You may probably want to check out this link for information on how to use the date/time more naturally with the form builder.

    http://guides.rubyonrails.org/form_helpers.html#using-date-and-time-form-helpers

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

Sidebar

Related Questions

I have a tool that is setup to query our Clearquest Database to return
I'd like to have a tool window in Visual Studio that allows me to
I have a GUI tool that manages state sequences. One component is a class
I have written a tool to collect log files within a time window specified
So I have an app (tool) that uses .NET 3.0. When run on a
Sample HTML Data <body style=width:300px;> <h3>Long-Text</h3> A simple tool to store and display texts
I have a custom tool which is set up as a pre-build event, it
I have a tool with a configurable delay (Timespan), and I want to set
I am trying to set up a C# tool that scripts an entire database
I'm doing a quote creator tool. There is a table that will store all

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.