I have a field in db with datetime format and it contains more than just
simple date. How can I get only date from it?
On Dec 9, 3:21 am, “Vapor …” [email protected] wrote:
I have a field in db with datetime format and it contains more than just
simple date. How can I get only date from it?
What does your format look like?
What database are you using?
How are you connecting Ruby to the database? Are you using
ActiveRecord? Something else?
Do you already have instances of a Ruby Time class? DateTime class?
Do you want an instance of a Date class? Do you just want to visually
display the date only information?
More information required…
Gavin K. wrote:
On Dec 9, 3:21 am, “Vapor …” [email protected] wrote:
I have a field in db with datetime format and it contains more than just
simple date. How can I get only date from it?What does your format look like?
What database are you using?
How are you connecting Ruby to the database? Are you using
ActiveRecord? Something else?Do you already have instances of a Ruby Time class? DateTime class?
Do you want an instance of a Date class? Do you just want to visually
display the date only information?More information required…
oh well
I am using MySQL and when I look into it, it shows something like
‘2007-12-10 18:58:17’ like this.
And I am using all the default settings (ActiveRecord and stuff)
You probably look for something like this:
myDate.strftime(’%Y%m%d’)
by
TheR