Yep! Sequel.function(:lpad, Sequel.cast(created_on.extract(:month), :text) , 2, '0'))
Solved my problem. On Monday, August 17, 2020 at 12:43:38 AM UTC+3 [email protected] wrote: > Hi, > > Possible Raw SQL would be: > > lpad(extract(month from now())::text, 2, '0') > > Is it possible to accomplish this query in Sequel? > > On Monday, August 17, 2020 at 12:41:09 AM UTC+3 [email protected] > wrote: > >> Hi, >> >> I want to extract month from date but it extracts: >> >> 2020-07 (July 2020) >> >> as: >> >> 2020-7 (Without zero padded). >> >> My code: >> >> Sequel.as(concat(created_on.extract(:year), '-', >> *created_on.extract(:month)*, 'date_year_month') >> >> This code give me "2020-7" instead of "2020-07". >> >> How can I use *lpad *here or any idea? >> >> Dennis. >> >> -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/d5c6f33e-4188-4acd-a04e-16b3306ab39fn%40googlegroups.com.
