Ordering by a custom date field? - ruby-on-rails

I have a date field in my model which allows me to enter a date in the format of DD/MM/YYYY for example 10/01/2015 - How would I go about ordering by this model entry? So I have the soonest dates displayed first?
Any help/hints would be great :)

Related

Google Sheet-Date validation in specific format

how to use specific date formats in data validation in Google Sheets.
I set this date format in google sheet dd-mmm-yyyy (09-Jan-2023) but the user enters a different date format in the sheet so im want to use data validation for this the user must enter data in specific format dd-mmm-yyyy
i want that when user enter data in different format its auto rejects entry.
try:
=REGEXMATCH(A1&""; "\d{2}-.{3}-\d{4}")
or:
=REGEXMATCH(A1; "\d{2}-.[A-z]{3}-\d{4}")
If you previously set the date format in the range you want, then no matter in which way the date is inserted then it will be displayed as you wish. Specially with mmm format you'll be always at risk that they can mess with how the month is supposed to be written, I think it's preferably for them to insert the number and you choose how it is displayed

Difference in Milestone TargetDate value and Custom field DateTime value when passed the same date

I am trying to save a dateTime value in my custom field in the Milestone Object Model and I see something is different between the TargetDate and my DateTime custom field:
For example I am saving "2018-04-06T00:00:00.000Z"to TargetDate and my custom field but on Rally side, its saved in two different format. Why would that be the case?
Thank you!
I think I know why. All the dates are converted to UTC for built in fields whereas for custom fields it expects the date to be UTC.
Converted my c_date to UTC and saved it and they matched :-)
Thanks!

Should date field in DW date-map be of Date data type or of String data type, if I want to put placeholders?

I have a date map (date dimension) like every other data warehouse.
The most obvious way to store date field in the date field is in date datatype. However, I want to keep some records in my date dimension which ID as negative values and the date field should give description of why this date is invalid.
For example, in my fact table, let's say I have a field called order_date_id which references the date dimension. However, for some records in the fact table, I want to say that the order_date was not recorded by the system and hence we can't use it. But I want it's entry present.
I thought that I would make an entry in the date dimension with ID=-1 and date = 'Date was not recorded'. But to use this kind of a placeholder, I will have to keep date as a string value. If I store it as a string value it will be very ineffective when I compare two dates.
Please advise a good practice.
I think you are confusing two things;
Date Dimension Design
Identification of Date not assigned by system
This is how I would design the date dimension
Date_id = number with yyyymmdd - intelligent key and this will be the primary key; this saves doing a lookup to the database to assign the id
Date - the actual date
Year - year
Month - Month (yyyy-mmm or yyyy-mmmm)
Month_Nbr - Month ( yyyy-mm )
Quarter - yyyy-Qn(1,2,3,4)
all the other attributes you need
if there are sales order which do not have a date assigned, assign them 19000101 and have them in your fact table...
if you incrementally keep getting sales order without dates, then I would consult the business and put in the 1st day of the month of when they are arriving into the system; this will be a more acceptable solution.

custom validation for telerik date picker?

I am using telerik date picker. Date format is dd/mm/yyyy. If user enters it as ddmmyyyy then also it will be converted into format as dd/mm/yyyy. Now if user enters something like ddmmyy i.e. if year is only of 2 digits then i want to throw error message for the same to enter date in valid format. Also this date field is not required. So want to show this message if wrong format of date is entered on blur event of date field.
From my experience and with this demo from the Telerik Site it works if you do ddmmyy or ddmmyyyy by default if you have it set to a culture that commonly uses that style. Ex. Canadian English or en-CA.
If you have have specified your format as "dd/mm/yyyy" then the user will have to enter it as so or it will appear incorrect. You could use some java script to convert it to a proper format, but it would be a lot easier to just set up the date picker properly.

Creating List Webpart: Ordering by Date field and Type

I am trying to create a web-part to show items that relate to a certain field and are before an expiration date using a web-part in SharePoint 2007.
The list has a Title field, a URL field a Related field and an ExpireDate field.
So the list looks like this:
Title URL Related ExpireDate
Resolution http://blah Service 5/14/2013
Solution http://blah2 Records 9/14/2012
So if I need the items that are related to service today's date is before the expiration date I want it to display.
Do I need a calculated Column?
Ended up using a view where ExpireDate is greater than or equal to [Today] And RelatedField contains Service.

Resources