We have a lobby by week that is not sorting the MM/DD date correctly since it treats it as text.
Can we:
1.) change it to a Date (didn’t work in the DataSource) so it sorts/orders correctly.
2.) Add a leading zero to single-digit months and days.
We have a lobby by week that is not sorting the MM/DD date correctly since it treats it as text.
Can we:
1.) change it to a Date (didn’t work in the DataSource) so it sorts/orders correctly.
2.) Add a leading zero to single-digit months and days.
question is not quite clear though, is it related to date and month format fixing below queries may help you.
SELECT to_number(to_char(SYSDATE, 'W')) weeks FROM dual; --to get the current week of the month
SELECT to_number(to_char(SYSDATE, 'D')) days FROM dual; --to get the current day of the week
SELECT to_number(to_char(SYSDATE, 'DD')) to_day FROM dual; --to get the current date of the month
SELECT to_number(to_char(SYSDATE, 'MM')) to_month FROM dual; --to get the current month
SELECT to_char(SYSDATE, 'MM/DD') DD_MM FROM dual; --to get the current month/date
hope above will helpful for your findings..
thx, I’ll try those.
To clarify, these two dates, 3/9 and 3/30, are sorting as 3/30, 3/9 instead of 3/9, 3/30 because it’s treating these as alphanumeric field type instead of Date.
Here’s the DataSource that shows it incorrectly sorted:
So basically you need to order your weeks accordingly. Try using Order By week ASC (ascending order may help in this situation).
thx! I’ll try that...
This worked perfectly! Thanks!!!
SELECT to_char(SYSDATE, 'MM/DD')
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.