date format

S

Sijo Kg

Hi
I have code
sd_ticket_end_date=Date.today
This gives 07/14/2008 00:00
How can I format this to 2008-07-14

Thanks in advance
Sijo
 
S

Sijo Kg

Hi
Could you please help this also..I have a string
sd_ticket_end_date= 15/01/2008
Then how can I format this to 01/15/2008


Sijo
 
P

Peña, Botp

RnJvbTogc2lqb0BtYXh4aW9uLmNvbSBbbWFpbHRvOnNpam9AbWF4eGlvbi5jb21dIA0KIyBDb3Vs
ZCB5b3UgcGxlYXNlIGhlbHAgdGhpcyBhbHNvLi5JIGhhdmUgYSBzdHJpbmcNCiMgICBzZF90aWNr
ZXRfZW5kX2RhdGU9IDE1LzAxLzIwMDgNCiMgVGhlbiBob3cgY2FuIEkgZm9ybWF0IHRoaXMgdG8g
MDEvMTUvMjAwOA0KDQpIaSBTaWpvLCANCmlmIGl0J3MgYSBzdHJpbmcsIHRoZW4gdHJlYXQgaXQg
bGlrZSBhIHN0cmluZywNCg0KaXJiKG1haW4pOjAwMjowPiBzZF90aWNrZXRfZW5kX2RhdGU9ICIx
NS8wMS8yMDA4Ig0KPT4gIjE1LzAxLzIwMDgiDQoNCmlyYihtYWluKTowMDQ6MD4gZCxtLHk9c2Rf
dGlja2V0X2VuZF9kYXRlLnNwbGl0ICIvIg0KPT4gWyIxNSIsICIwMSIsICIyMDA4Il0NCg0KDQpp
cmIobWFpbik6MDExOjA+IG0rIi8iK2QrIi8iK3kNCj0+ICIwMS8xNS8yMDA4Ig0KDQpvciB0aGUg
ZmFuY3ksDQoNCmlyYihtYWluKTowMDk6MD4gW20sZCx5XS5qb2luICIvIg0KPT4gIjAxLzE1LzIw
MDgiDQoNCg0KYmFzaWNhbGx5LCBqdXN0IHJlbGF4IGFuZCBwbGF5IHcgcnVieS4uLg0KDQpraW5k
IHJlZ2FyZHMgLWJvdHANCg==
 
M

Michael W. Ryder

Raveendran said:
Sijo said:
Hi
Could you please help this also..I have a string
sd_ticket_end_date= 15/01/2008
Then how can I format this to 01/15/2008


Sijo

Example 1:

a="15/01/2008"
x=a[0,2]
a[0,2]=a[3,2]
a[3,2]=x
puts a => 01/15/2008

or you could use a = a[3,3]+a[0,3]+a[6,4]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top