search for: date_format

Displaying 20 results from an estimated 68 matches for "date_format".

Did you mean: date_formats
2007 Nov 02
0
DATE_FORMATS and functional tests
I have the following in my environments.rb file: my_formats = { :msc => ''%d %b %Y %I:%M %p'', :msc_short => ''%d %b %Y'' } ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge! (my_formats) ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge! (my_formats) With this, things like ''invite.created_at.to_s(:msc_short)'' work perfectly in all my views during normal operation. However, any functional test that includes a view template...
2006 Mar 14
21
Changing default date format in Rails
I''ve spent all day digging through the rails api and postgres-pr on this, I think it''s time to ask the list. Postgres stores a Date in YYYY-MM-DD format. My users want the dates in MM/DD/YYYY format. Sure, I could explicitly convert it on the app level every place where a date is displayed, but that seemed like a DRY violation. I thought I''d be clever and simply
2008 Jun 07
3
DRY validates_format_of?
In a model I have following validates_format_of. Is there an easy way to DRY this up? It seems to be rather repetitive. validates_format_of :expiration_date, :with => /^[0-9]{4}[-][0-9]{2}[-][0-9]{2}$/ validates_format_of :activation_date, :with => /^[0-9]{4}[-][0-9]{2}[-][0-9]{2}$/ validates_format_of :some_other_date, :with =>
2006 Jul 17
2
european date format
...nter the date in iso format, so i have to make my applications in such a way that not only dates are displayed in the "dd-mm-yyy" format but also can be entered in that way. somewhere i found this code to put in the environment script: ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update( :default => ''%d/%m/%Y @ %H:%M: %p'' ) ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.update( :default => ''%d/%m/%Y'' ) this works great for displaying dates, the only problem is i can''t input a new date anymore: i tried...
2006 Mar 23
5
Custom date format
...DefineYourOwnDateFormat.html It seems pretty straightforward but obviously it doesn''t work for me... article.date_edited.to_formatted_s(:my_format_1) produce a default formatted date, not the one I''ve defined in environment.rb : ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!( :my_format_1 => ''%d/%m/%Y - %H:%M'', :my_format_2 => ''%l:%M %p, %B %d, %Y'' ) What''s wrong ? Thanks -- Posted via http://www.ruby-forum.com/.
2009 Jun 15
1
calendardateselect problem
I am using http://code.google.com/p/calendardateselect/ for my date time picker. I am using dd.mm.yyyy format (:finnish) and i am using ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge! (:default => "%d.%m.%Y") ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge! (:default => "%d.%m.%Y %H:%M") in my enviroment. Everything is working fine on my machine. However when I deploy on heroku day and month switch places so : 12.01.2009 be...
2003 Jul 11
4
module : cdr_sybase.so
...t; #include <asterisk/module.h> #include <asterisk/logger.h> #include "../asterisk.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include <sybfront.h> #include <sybdb.h> #define DATE_FORMAT "%Y-%m-%d %T" static char *desc = "Sybase CDR Backend"; static char *name = "sybase"; static char *config = "cdr_sybase.conf"; static DBPROCESS *dbproc; static LOGINREC *login; static struct tm _date(struct timeval tv) { struct tm tm; time...
2005 Sep 06
1
US Date Handling in Rails
My application is built on Rails and MySQL. It will only be accepting US formatted dates as input, however both Rails and MySQL are oriented around ISO the format. I know I can convert a good portion of the entries using ParseDate::parsedate but it does not appear this is how the conversion is taking place when data is being transferred from the params hash into model members. Say I have a field
2006 Jun 14
5
display formatted date
Hi, In my form I have date field set as ''datetime_select'' which is fine as I wanted it in the same format. But while displaying (list action) it displays date in long format i.e. ''Tue May 30 15:39:00 Central Daylight Time 2006''. How can I format it so that it will just be diaplyed as ''dd/mm/yyyy'' format? Thanks -- Posted via
2006 Jul 27
9
CalendarHelper
...anyone had any luck using the CalendarHelper plugin at http://wiki.rubyonrails.com/rails/pages/CalendarHelper recently? I''m scratching my head over the following error when I look at any page in my application: NameError in CalendarController#index undefined local variable or method `date_format'' for #<CalendarController:0x24ccd4c> RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/controllers/application.rb:8:in `localize'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/filters.rb:399:in...
2006 Feb 23
2
find_by_sql aliasing issue when accessing attributes
I was recently having problems accessing attributes in an object. Can somebody explain to me why this is, and if it is a bug? I have the following code: @archives = RapturePost.find_by_sql "select distinct date_format(rapture_posts.date_created,''%Y-%m'') date_created from rapture_posts where rapture_posts.site_id = 1 order by rapture_posts.date_created desc" I wish to loop through the contents of the object with the following: for archive in archives #do something with the contents of a...
2006 Aug 17
3
Use collection_select
I use the following code in my view: <%= collection_select(''datedata'', ''date'', @allDate, :id, :date) %> It''s show me the date of all entries in the database (Dropdown menu). Additional, I wrote a helper method "showDate" in the application_helper.rb! How can I use this method in the collection_select for every date entry? thanks
2006 Jan 07
1
How to DRY with Fixtures (helper or extend Time class, how)?
I have a test/fixtures/users.yml like so: apa: id: 1 username: apa [...] created_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%> updated_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%> I don''t like how I''m repeating myself with the strftime bit. Is there some shorter Time method to format time for a (MySQL) datetime field that
2018 May 09
0
Seasonal weekly average
Hi Shakeel, Assuming that you are starting with a bunch of dates: # make a vector of character strings that can be converted to dates rep_dates<-paste(sample(1:30,500,TRUE),sample(1:12,500,TRUE), sample(2013:2017,500,TRUE),sep="/") # if this isn't your format, change it date_format<-"%d/%m/%Y" # create a data frame with a column of dates rep_df<-data.frame(rep_dates=as.Date(rep_dates,format=date_format)) # add the week of the year rep_df$rep_week<-format(rep_df$rep_dates,"%V") # add the year rep_df$rep_year<-format(rep_df$rep_dates,"%Y&quo...
2010 Aug 13
4
Rails and Oracle - can select date but cannot save
I''m seeing a behavior in Rails that I find very strange. Having worked quite a bit with Oracle with other languages I would always dutifully do ALTER SESSION SET NLS_DATE_FORMAT = <my_date_format> and ensure I use that date format in my application. With Rails I still have not figured out how to execute an ALTER SESSION statement after connecting to the database (I''m using the the jdbc adapter). And sure enough I get a "date format not recognized"...
2006 Feb 10
14
dynarch calendar and calendar helper usage
I am playing around with this and reference this wiki from RonR site... http://wiki.rubyonrails.org/rails/pages/CalendarHelper The error I am getting is: NameError in Placements#list undefined local variable or method `date_format'' for #<PlacementsController:0xb78f9ef4> RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full Trace ./script/../config/../app/controllers/application.rb:9:in `localize'' Makes sense... the lines in application.rb are: prepend_before_filter :localiz...
2009 Jul 28
3
CIsco 7960 + asterisk: hepl needed
...ed IP or FQDN proxy_register: 1 messages_uri: 80 phone_password: cisco ; Limited to 31 characters (Default - cisco) sntp_mode: directedbroadcast ;"unicast" sntp_server: 192.168.1.77 time_zone: GMT+01/00 ; assuming you're in GMT time_format_24hr: 1 ; to show the time in 24hour format date_format: D/M/Y ; format you would like the date in dial_template: dialplan SIP<MAC>.cnf: image_version: P0S3-8-12-00 line1_name: 55 line1_authname: 55 line1_shortname: 55 ; displayed on the phones softkey line1_password: 12345655 line1_displayname: "Lukasz Cisco7960"; the caller id prox...
2018 May 09
3
Seasonal weekly average
Hi, I am fairly new to 'R' and would like advice on the following. I want to calculate a weekly average number of reports (e.g. of flu, norovirus) based on the same weeks for the last five years. I will then use this to plot a chart with 52 points for the average based on the last five years; another line will then plot the current year, enabling a comparison of current weekly counts
2006 Jul 27
1
getdate_column
..., "1/2/06 10pm"). I personally find date controls on the web to be clumsy, and would prefer to just have a text field where I can enter a reasonable representation of a date. USAGE =================== class Event < ActiveRecord::Base getdate_column :start getdate_column :finish, :date_format => :short end >> e = Event.new => #<Event:0x252e240 ... > >> e.start = "tomorrow" => "tomorrow" >> e.start => "July 28, 2006 09:12" >> e.start(:raw) => Fri Jul 28 09:12:39 PDT 2006 >> e.start(:raw).class => Time I...
2007 Nov 19
2
login help - grouping records
I have a long list of posts posted on different days and many posts every day. I want them to arrange like following... Date1 ----- post1 post2 Date2 ----- post3 post4 post5 How can I (say) group them to appear all posts of one date under their related headng. Because records have so many different days, it is confusing me.. I need some generic solution. Thanks in advance. -- Posted via