Date Format help: LUN - AA
Hello
We have a field of database where the date is stored in the form DD-MON-AA . I have to write a query where I select records in MM1 - YY1 in MM2 - YY2.
The data in the table are in the format DD-MON-AA. The data provided by the query for the query are MON-YY.
The MM1 - YY1 represents the first day of the given month. MM2 - YY2 is the last day of a month. My colleague wrote a query failed as MM1 - YY1 as always the first of each month. That is right. She wrote MM2 - YY2 as always 31' St of each month. The bug is that the code does not work for the months where less than 31 days ago. For example, February and June do not have 31 days.
I am concerned by the month, leap year handling et al., because they are so many additional code and the logical error prone. Is it possible to use the to_date MM-YYYY when the column in the database is YYYY-MM-DD?
I pasted the current code to give a hint.
and svalid_to between to_date ("' | earliestExpiry |) (' ', "YYYY-MM-DD")
and to_date ("' | latestExpiry |) (' ', "YYYY-MM-DD ') ';
Thank you
and svalid_to between to_date(earliest_expiry,'mm-yy') and last_day (to_date(last_expiry,'mm-yy'))
Tags: Database
Similar Questions
-
Date Format help: LUN-JJ-AA
Hello everyone.
Nice day.
I would like to ask for your help regarding my inquiry on the output of the PL/SQL script that I am creating.
Please find below my script output:
L7, CU4450278, 70X1W01AGA-ASY, 11813,20-6ae-13, 0
L7, CU4464442, 747X32VH9015-ASY, 3394,20-6ae-13, 0
L7, CU4464766, 747X22VH9015-ASY, 3383,21-6ae-13, 0
As you can see in the output CSV, the date has an invalid value, the "6ae" should be Jun (e.g. a format short month of June).
My script has this code for date dbms_output to_char(startplan_rec.str_startdate,'DD-MON-YY')
The startplan_rec.str_startdate is of type date.
I tried to interview the same table in oracle sql developer, but I am getting output correctly (for example 20 June 13).
Please, help me to have my out of date format on my pl/sql. Why is my release date on my incorrect script?
Thanks in advance.
Kind regards
Jeff.
In your PL/SQL, try to specify the language setting in the optional 3rd parameter that is often ignored in to_char(), as follows:
to_char(startplan_rec.str_startdate,'DD-MON-YY','nls_date_language=english')
-
Hi all
I have a table with a column report_date (varchar2 (20));
the data is stored in this way in this column
Ex:
20111017
20111016
20111024
20110918
Format: YYYYMMDD
How can I find the dates between October 15, 2011 and October 17, 2011 when the data is stored in this format?
Help, please. Thanks in advanceHello
MR Marie wrote:
Hi allI have a table with a column report_date (varchar2 (20));
the data is stored in this way in this column
Ex:
20111017
20111016
20111024
20110918Format: YYYYMMDD
How can I find the dates between October 15, 2011 and October 17, 2011 when the data is stored in this format?
Help, please. Thanks in advance
Since you have strings, and DATEs not real, the more effective and less prone to passing error is:
WHERE report_date BETWEEN '20111015' AND '20111017'
Stroing date in a VARCHAR2 column information are not a good idea. It is better to use TIMESTAMP (or DATE) instead.
-
Hi all
Someone saw a tag, or got an algorithm which formats date ranges?
I want to go
September 12, 13, 20, 21, October 6, 7, 8, 9, 10, 11, 12
TO
12 September-13, 20 and 21, 6-12 October
David HeacockVery cool :-)
Not quite what I was looking for, but still very cool. I ended up building just a set of nested loops and arrays to do. Not very elegant, but effective.
-
Convert the date of "MON/dd/yy" format to "LUN/yy '.
I know there is probably a load of questions already on it, but I can't find a simple simple explanation with examples on how to change the date format "MON/DD/YY" in month/year format "LUN/YY '.
Can someone help with a useful answer, thank youwoof777 wrote:
I know there is probably a load of questions already on it, but I can't find a simple simple explanation with examples on how to change the date format "MON/DD/YY" in month/year format "LUN/YY '.Can someone help with a useful answer, thank you
The DATE data type have No. format, & can be presented with TO_CHAR sort
SQL> select to_char(sysdate, 'MON/YY') from dual; TO_CHAR(SYSDATE --------------- AUG/12
-
How do I change the date format in the section of the United States to the United Kingdom
As in the question.
Hello
I had a glance in this and have found that Thunderbird uses the date format of your computer system. If you change it, it should be reflected in Thunderbird.
I hope this helps, but if not, please come back here and we can look at another solution for you.
-
How can I configure the cell data format
How can I configure data format of cell numbers: for example, I want to capture 123456.78 and need to be 12A3456.78?
I tried to put #A # #. # format option, but it didn't work a few time and it became A123456.78.
I also tried on excel and it worked very well, but I like the numbers better. is there a solution to this problem?
Thank you
HEY Chi - Lun,
I don't think that this is possible as many number format. You should be able to insert A in a text string using a formula, but this would happen in a second cell, not that the number has been entered.
"Assuming all the"numbers require the same inserted letter after the second number, this should do the work."number" entered in column A; the formula in column B. In the table below, your value as an example is A6.
= Left (A, 2) & "A" & RIGHT (A, LEN (A) - 2)
Kind regards
Barry
-
For example, the Date of beginning of life cycle shows 31/05/2001 (March 5) and the end of Support Date extended watch 07/12/2001 (12 July or December 7).
The date format is month/date/year. This format is for the start date and end date for extended Support.
In your example, the start date is May 31, 2001, and the end date would be July 12, 2001.I hope this helps.
Marilyn
-
Cannot save the incorrect date format
I keep trying to save my computer... tells me incorrect date format?
I had the same problem and ended up going through the online chat. I guess there is a problem with the site, but they managed to sign up to my computer via chat. Hope that helps
-
The locale for the Serbian State that the date format is DD. "" MM.yyyy "which is not true. No correct date format in the end, IE. DD."MM.yyyy. »
Where can we report this bug?
Hi lieth43,
You can submit your bug report in this link.
Hope the helps of information.
Concerning
Joel S
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think. -
How to change the date format in the United States to the United Kingdom
my laptop date format changed to English WE that is dd/mm/yyyy. I tried to change it to English UK that is DD/MM/YYYY, but it does not change.
I would appreciate if I could help out the English American date format and change date format English UK as all my accounts work stayed in waiting for the last week.
- Right click on the clock in the task bar, then choose "Adjust Date/time".
- Click Change Date and time...
- Click on change the calendar settings
-
Step 1. I choose Chinese (PRC) in the list format (region and language) and set the format of 'YYYY-MM-dd' date, apply. It is ok.
Step 2. I choose English (United States) in the list format (region and language) and set the format of 'YYYY-MM-dd' date, apply. It is ok.
Step 3. I chose the back to Chinese (PRC) in the format list (region and language), format date is reset to "YYYY/M/d", it is not ok for me.
How can I set the format of a two language. ?
Because I use the siemens industry software, when to change language it will read the date format different from the language that is displayed. My client want to see the same format.
I tested under Win XP, it may set the format even in different languages
Hi Jerry,
Thanks for posting the request in Microsoft Community Forums.
It is normal that you can not set the same date format for both languages at the same time. You will need to use the drop-down list to choose a date format customized if necessary.
Hope this information helps.
-
public static String Selectdate() { DateTimePicker datePicker = DateTimePicker.createInstance(); datePicker.doModal(); Calendar cal = datePicker.getDateTime(); Date date = cal.getTime(); return date.toString(); }
I use the method above to choose the date, but it also shows me the time that I need to see the time I just wants to select only the date. Can someone help me please...
The API tells you how to do that is it not?
public static DateTimePicker createInstance (calendar, calendar,
String datePattern,
String timePattern)Returns a date with an initial display date picker and the format of the date and time. If datePattern and timePattern are null, then will serve as the default time and date formats.
Parameters:
calendar - original date to display
datePattern - the SimpleDateFormat to date. If datePattern is null and timePattern is not null, then a date will not be shown. The model should include only text templates (for example ' / ',': ') and date of models for example DateFormat.YEAR_FIELD, DateFormat.MONTH_FIELD, DateFormat.DATE_FIELD, DateFormat.DAY_OF_WEEK_FIELD. Other symbols of format will be ignored.
timePattern - the SimpleDateFormat for now. Passing null will not display a time if timePattern is null and datePattern is not null, then an hour does not appear. -
Change the Date Format automatically...
I have a windows 7 AD 2003. I change setting, regional date format DD/MM/YYYY additional parameters after restarting the PC automatically Charron in the format dd/mm/yyyy... How to solve... Thanks to advaceAut
Hi Noufal,
Welcome to the Microsoft Community Forum.
-Wht you mean AD 2003? Active Directory 2003 are you referring?
If the question is limited to Active directory 2003, it is better suited for the IT Pro TechNet public. Please ask your question in the Forum on TechNet Support.
http://social.technet.Microsoft.com/forums/en-us/winserverDS/threadsI hope it helps. If you have any questions about Windows in the future, please let us know. We will be happy to help you.
-
Sort data in date format DD/MM/RRRR
Hello
I have to sort our data between two dates ex 01 01, 2016 to the 31/01/2016 for the list of transactions.
Will I convert in JAN-16 format so that I can sort by where period_name like ' JAN-16'?
If so how do I convert a date format of 01/01/2016 JAN-16?
Thank you
Hello
Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.
Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: Re: 2. How can I ask a question on the forums?
As Chris and Tubby has said, all DATEs are stored in the same internal format, which has nothing to do with the format you use to view or format you use in conversion as TO_DATE functions.
Oracle provides many functions and other features for the manipulation of DATEs, you seldom need to convert them to another format. For example, we wanted to get a list of employees of the scott.emp sorted by month and by ename; in other words, December 1980 would come before April, 1981, as from habit, but the day of the month, hours minutes and seconds would all be ignored in sorting. We can use the TRUNC function to do this:
SELECT TO_CHAR (hiredate, 'Mon-YYYY') AS hiremonth
ename
hiredate
FROM scott.emp
ORDER BY TRUNC (hiredate, 'MONTH')
ename
;
Output:
HIREMONTH ENAME HIREDATE
---------- ---------- -----------
DEC-1980 SMITH December 17, 1980
Feb-1981 ALLEN 20 February 1981
Feb-1981 WARD 22 February 1981
Apr-1981 JONES April 2, 1981
May-1981 BLAKE may 1, 1981
Jun-1981 CLARK June 9, 1981
MARTIN 1981-Sep 28-Sep-1981
Sep-1981 TURNER 08-Sep-1981
Nov-1981 KING November 17, 1981
DEC-1981 FORD December 3, 1981
DEC-1981 JAMES December 3, 1981
Jan-1982 MILLER January 23, 1982
Apr-1987 SCOTT April 19, 1987
May-1987 ADAMS 23 May 1987
Notice how MARTIN comes before TURNER in the output (I marked these Redlines), even if MARTIN hiredate is 20 days later than TURNER. This is because only the year and month are considered in the sorting. Any DATE in the same month will get the same sort value.
Maybe you are looking for
-
EliteBook: portable pen no longer works after reinstalling windows
Windows 7 crashed the week last on my Elitebook. I have re-installed and now my pen to laptop no longer works. Can anyone help? Thank you.
-
My iPad 2 can't find my printer deskjet 3050 J610 series wireless
Hello. My iPad 2 can't find my printer deskjet 3050 J610 series wireless. Can I do anything to make it work? According to the list of compatible wireless Apple printers, support is the deskjet 3050 a. j611a is there something I can do? Some driver? T
-
I don't know what I'm missing, but I have an IP address that is not the route. Gateway of last resort is 192.168.3.14 to network 0.0.0.0 S * 0.0.0.0/0 [1/0] via 192.168.3.14S 192.168.1.0/24 [1/0] via 192.168.23.1192.168.3.0/24 is variably divided int
-
BlackBerry Smartphones not able to get pictures of my application in Saudi Arabia
Hi guys,. I do a soft for Saudi customer. My problem is that I am not able to download the images to the location of the customer. The same code works perfectly in my rental (India). The only positive thing is that xmls are downloaded to the location
-
I have a new computer and I need help, download of lightroom to my new computer. I also want to upgrade to the latest version.