Problem I wrote two functions for determining leap years. (“Kabisat” means “leap year” in Indonesia.) def kabisat? y return false […]
Tag: datetime
Displaying TimeSpan as largest interval (with units) – Part II
Problem [This is a follow-up question to: Displaying TimeSpan as largest interval (with units). The code listed here has been […]
Calculate date for ordinal day of week in month
Problem I am writing some date utility methods for a project. One of the methods will answer the following questions […]
Matching a time interval using regex
Problem What I needed to do was check whether a given string matches a certain pattern. The pattern is this: […]
Converting click count data to JSON
Problem I have an array filled with 5 other arrays that consists of arrays of 2 values (first a date […]
Difference between dates in Months and Days [closed]
Problem Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add […]
Bitwise operation to get the weekday name
Problem The function days_name receive a val (string) corresponding to weekdays in hexadecimal. def days_name(val) value = val.to_i(16) week = […]
Formatting MMyyyy to MMyy
Problem The following is my sample code: String month = “09”; String year = “2014”; String monthYear = “092014”; The […]
Rake task to send users a reminder to post with conditions
Problem I am implementing a feature that reminds users to make a post via email if the user has set […]
Dynamic array of Years
Problem I wanted to make a dynamic select statement from this year to 10 years. This gets the job done, […]