Strange date output
Greetings, I have created a CustomTag in Coldfusion that calls a simple class file I created, I'm not sure the output is correct though,
Calling template
<html>
<head><title>test cfx</title></head>
<body>
<CFX_SimpleMessage NAME="DoodleHead">
</body>
</html>
JAVA class
//import allaire interfaces to enable custom tag - response / request / query
import com.allaire.cfx.*;
import java.util.*;
import java.text.DateFormat;
public class SimpleMessage implements CustomTag{
Date now=new Date();
DateFormat f=DateFormat.getDateInstance(DateFormat.FULL,Locale.US);
public void processRequest(Request request, Response response)
throws Exception
f.format(now);
String name=request.getAttribute("NAME");
response.write("Hello, "+name+"! Today is " + f);
the resulting output is this,
Hello, DoodleHead! Today is java.text.SimpleDateFormat@7f195eec
Im sure this is not right?
Ok I deleted my class files, stopped and restarted my server as it can cache class files, recompiled, but the same output.
String name=request.getAttribute("NAME");
response.write("Hello, "+name+"! Today is " + f.format(now));
results in,
Hello, DoodleHead! Today is java.text.SimpleDateFormat@7f195eec
Similar Messages
-
Ok, so i'm new to CF, so bear with me please.
I have a MYSQL database, which is storing information entered
by a friend of mine in Japan.
The output of single and double quotes looks almost japanese.
In the database, i see
(Here's a tip for pronunciation; "desu" is pronounced "des",
the "u" is silent! ) with really small quotation marks
What shows up is :
(Hereメs a tip for pronunciation; モdesuヤ
is pronounced モdesヤ, the モuヤ is silent!
Now, if i look at the output through a php page, i get it
displayed correctly.
Can someone help me out? Is it his keyboard? Is there a way
to fix this?
thanks in advanceThis is a Firefox only problem, IE is fine.
Then it is probably just a display issue. A more appropriate
solution would be to start the page with
<cfheader name="Content-type" value="text/html;
charset=utf-8">
or
<cfcontent type="text/html; charset=utf-8">
Threestate should use UTF-8 all along the line, beginning
with his friend storing the information in UTF-8. As things stand
he could find a temporary solution by experimenting with various
Japanese encoding values for the charset, like ISO-2022-JP,
Shift_jis, euc-jp. I am not very familiar with Japanese encoding. I
have picked these out from the Coldfusion livedocs for
cfprocessingdirective,
cfheader
and
cfcontent. -
Report is executing in background and need data(output) in excel format
Report is executing in background and need data(output) to get downloaded in excel format in my PC from an internal table;;in any drive i.e. C: or D: .When executing in backround it prompt to user with which location excel file to be saved and the name of file.How to download in background in excel format?
Edited by: PRASHANT BHATNAGAR on Aug 26, 2008 6:24 AMHi
Download a report to excel with format (border, color cell, etc)
Try this program...it may help you to change the font ..etc.
Code:
REPORT ZSIRI NO STANDARD PAGE HEADING.
this report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
INCLUDE OLE2INCL.
handles for OLE objects
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT. " font
TABLES: SPFLI.
DATA H TYPE I.
table of flights
DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
*& Event START-OF-SELECTION
START-OF-SELECTION.
read flights
SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
display header
ULINE (61).
WRITE: / SY-VLINE NO-GAP,
(3) 'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(4) 'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
(8) 'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
ULINE /(61).
display flights
LOOP AT IT_SPFLI.
WRITE: / SY-VLINE NO-GAP,
IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
ENDLOOP.
ULINE /(61).
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-007
EXCEPTIONS
OTHERS = 1.
start Excel
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-008
EXCEPTIONS
OTHERS = 1.
get list of workbooks, initially empty
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP.
PERFORM ERR_HDL.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - start
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP EXPORTING #1 = 2.
PERFORM ERR_HDL.
tell user what is going on
SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT-009
EXCEPTIONS
OTHERS = 1.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
PERFORM FILL_CELL USING 1 3 1 'Von'(003).
PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
ENDLOOP.
changes by Kishore - end
disconnect from Excel
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'C:\SKV.XLS'.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
FORM FILL_CELL USING I J BOLD VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL.
SET PROPERTY OF H_ZL 'Value' = VAL .
PERFORM ERR_HDL.
GET PROPERTY OF H_ZL 'Font' = H_F.
PERFORM ERR_HDL.
SET PROPERTY OF H_F 'Bold' = BOLD .
PERFORM ERR_HDL.
ENDFORM.
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
Regards
Murali Papana -
Hi Gurus:
One of the business requirement is to EXTRACT data from relevant tables that the R/3 TCode "MRKO" provides in a report format in to BI. I don't tknow if there is any std. SAP extractor that would provide me the details. We need this data to determine the payment DATE based on "Payment Terms" using a logic, then summarize the data at each Vendor level and pass this information to the BI Cube. We need this information for a Cash Flow Forecasting project.
I am not familiar with the Tcode MRKO or the program. I would appreciate it if anyone can shed some light here. I basically need a Total Due amount for a month period, Vendor, The date on which the payment has to be made in future based on the Payment terms and Company code. I don't know the tables involved, but the TCODE provides a "Total" per Vendor and thats what I would like to capture and pass to BI. How can I achieve this?
Appreciate the name of the STD extractor if one exists or the table(s), and if any logic is necessary.....?
Thanks a lot in advance.....!
PBSWHI,
I am not aware of any standard extractor for the report that you get from Tcode MRKO, But I can suggest you in a very customized way to extract the data into BW.
When you run the transaction "MRKO", please check the program that is running in the background for that report to run and get the data output. You could easily find from the lower side menu bar.
Once if you get to know the program, create a structure and create a datasource assigned to that structure, where the datasource uses funcion module as its extraction method. In SAP you can easily convert a program into a function module and let the extractor fill your datasource for extraction.
- Another way of doing it, is to find out the tables that it is retrieving from the report MRKO and create a structure with those fields filled up using a function module. And then use that structure and function module for your new datasource to extract. -
How to show data output in SSRS
Below is my simply query. I need to use Matrix SSRS format. I will put "Region" in "row" column, Header will use "Customer_Requested_Date" field, and will use "Amount" in the data session.
The data output in the "Header" field will show January.....until December (current month is December). In the Amount field under "December" (current month), I need to compute the formula like "Customer_Request_Month"
< = Current Month". (I do not have the field name called Current Month, need to get a Date/Time function to display Current Month).
How I can come up the data output under December Header field to show the current Amount in that section?
November, 2014
December,2014
Region
Amount
CRD Month < = Current Month
Select
Customer_Request _Date,
Customer_request_Month,
Transaction_Type,
Region,
Amount
From Table
Thanks,
Josephine
Josey TangHi Josey,
According to your descritption, you want to show the current month in your tablix. Right?
In Reporting Services, we can use the Now() and datepart() function to get the current month. Please use the expression below:
=Datepart("m",Now())
In this scenario, since you want to show the amount of current month within the column group, you need to create another dataset which always show the data of current month. Then you can use lookup() function to get the amount value from the current dataset
based on the Region. Please follow the steps below:
Create a same dataset(DataSet2) using your query. Add a filter on this dataset. Make Fields!Customer_request_Month.Value
=
Datepart("m",Now())
Then add a column inside of column group, using the expression below:
=lookup(Fields!Region.Value,Fields!Region.Value,Fields!Amount.Value,"DataSet2")
The design and result look like below:
Reference:
Expression Examples (Report Builder and SSRS)
Lookup Function (Report Builder and SSRS)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
XML data output in a custom grid table
Hi!
I was wondering if it is possible to display xml data output in a custom-made grid table? Important is the ability to
arrange the fields on the grid layout (not a fixed layout with columns and rows).
I am using the latest JDeveloper release.
Thanks!See [url http://docs.oracle.com/cd/E14072_01/server.112/e10592/functions251.htm#CIHGGHFB]XMLTABLE
For example:
-- INSERT INTO <your table name>
WITH x AS
(SELECT XMLTYPE('<?xml version="1.0"?>
<ROWSET>
<ROW>
<EMPNO>7782</EMPNO>
<ENAME>CLARK</ENAME>
<JOB>MANAGER</JOB>
<MGR>7839</MGR>
<HIREDATE>09-JUN-81</HIREDATE>
<SAL>2450</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
<ROW>
<EMPNO>7839</EMPNO>
<ENAME>KING</ENAME>
<JOB>PRESIDENT</JOB>
<HIREDATE>17-NOV-81</HIREDATE>
<SAL>5000</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
<ROW>
<EMPNO>7934</EMPNO>
<ENAME>MILLER</ENAME>
<JOB>CLERK</JOB>
<MGR>7782</MGR>
<HIREDATE>23-JAN-82</HIREDATE>
<SAL>1300</SAL>
<DEPTNO>10</DEPTNO>
</ROW>
</ROWSET>') myxml
FROM DUAL)
SELECT *
FROM x
, XMLTABLE('/ROWSET/ROW'
PASSING x.myxml
COLUMNS empno, ename, job, mgr, hiredate, sal, deptno); -
How do I create individual xml files from the parsed data output of a xml file?
I have written a program (DOM Parser) that parses data from a XMl File. I would like to create an individual file with the corresponding name for each set of data parsed from the xml document. If the parsed output is Single, Double, Triple, I would like to create an individual xml file (Single.xml, Double.xml, Triple.xml)with those corresponding names. How do I create the xml files and give each file the name of my parsed data output? Thanks in advance for your help.
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class MyDomParser {
public static void main(String[] args) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse("ENtemplate.xml");
doc.normalize();
NodeList rootNodes = doc.getElementsByTagName("templates");
Node rootNode = rootNodes.item(0);
Element rootElement = (Element) rootNode;
NodeList templateList = rootElement.getElementsByTagName("template");
for(int i=0; i < templateList.getLength(); i++) {
Node theTemplate = templateList.item(i);
Element templateElement = (Element) theTemplate;
System.out.println("Template" + ": " +templateElement.getAttribute("name")+ ".xml");
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();Ive posted the new code but now I'm getting a FileAlreadyExistException error. How do I handle this exception error correctly in my code?
import java.io.IOException;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class MyDomParser {
public static void main(String[] args) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse("ENtemplate.xml");
doc.normalize();
NodeList rootNodes = doc.getElementsByTagName("templates");
Node rootNode = rootNodes.item(0);
Element rootElement = (Element) rootNode;
NodeList templateList = rootElement.getElementsByTagName("template");
for(int i=0; i < templateList.getLength(); i++) {
Node theTemplate = templateList.item(i);
Element templateElement = (Element) theTemplate;
System.out.println(templateElement.getAttribute("name")+ ".xml");
for(int i=0; i < templateList.getLength(); i++) {
Node theTemplate = templateList.item(i);
Element templateElement = (Element) theTemplate;
String fileName = templateElement.getAttribute("name") + ".xml";
Files.createFile(Paths.get(fileName));
System.out.println("File" + ":" + fileName + ".xml created");
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace(); -
Many messages are showing up randomly on my mail. They say no message, no sender and have strange dates. The text is gray; I cannot delete them. What is this?
The Best Alternatives for Security Questions and Rescue Mail
a. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
b. Call Apple Support in your country: Customer Service: Contacting Apple for
support and service.
c. Rescue email address and how to reset Apple ID security questions -
Shared photo stream wrong / strange date
When adding photo's to a shared photo stream sometimes strange dates appear.
The problem happens with scanned negatives. In my libarary I sort all photo's on date, so I have changed the date of all these scanned negatives and applied them to the originals.
The photo's in my normal libary show the correct date and time, however when I put the photo's in the shared photo stream it all of a sudden changes to a different date...???
It might well be the scanned date that the negatives were actually scanned, but this orignial date is nowhere to be found in the metadata.
I have done some testing and it also does not matter what the actual creation, modification, and last opened date of the file is.
Anybody any idea where this original date is residing in the file, how can I change it, and why is the shared photostream taking this date instead of dates in the aperture library.
Thanks !!The dates can be seen in the List View.
How ever in the project from where I shared the photo the date is correct:
These photo's are shot on film, yes good old film (as in the once you had to bring the a specialist to be developed and then printed). These negatives were scanned to jpg's and the jpg's imported in Aperture.
In Aperture I then painstakingly gave the right dates and approximate time, to be in the right order. (At this event at the same time there was somebody with a digital cam, so they are in the same project mixed with the scannes)
When adjusting the time, I also wrote the changes to the original file. However, somewhere Aperture remembers this date the pcitures were created eventhough the original file does not contain this date anymore (as far as I tell).
Since the photostream also uses the date for ordering the whole order is mixed-up... -
Can you please provide an example of test case using "Standard Data Output Cascade Mode"?
Hi,
I have tried creating a test to check the "Standard Data Output Cascade Mode". In Vivado 15.1, Ultrascale, it is working when I have data_width=1. However, if I modify the data_width to greater than 1, then I am not seeing the proper value for .CASCADE_ORDER_B. Is this expected?
The RTL is top.v. The addr_width=16, data_width=4. The synthesized vm netlist, test_syn.vm. It contains 8 BRAMS but the .CASCADE_ORDER_B parameter setting in the vm netlist is:
.CASCADE_ORDER_B("FIRST"),
.CASCADE_ORDER_B("MIDDLE"),
.CASCADE_ORDER_B("MIDDLE"),
.CASCADE_ORDER_B("MIDDLE"),
.CASCADE_ORDER_B("MIDDLE"),
.CASCADE_ORDER_B("MIDDLE"),
.CASCADE_ORDER_B("MIDDLE"),
.CASCADE_ORDER_B("LAST"),Hi
The parameter "CASCADE_ORDER_B" specifies the order of the cascaded block RAMs from the bottom to the top of the chain
for port B.
So the attribute value FIRST represents the bottom BRAM with respect to cascading. You can cross these attributes by opening synthesized design and observing the property of each BRAM.
Thanks,
Vinay -
User Defined Field that gives the date output of the last price update.
We would like to create a User Defined Field (UDF) with a Formatted Search (FMS) on the Item Master form that gives the date output of the last price update specifically the wholesale price.
Last Price Update
Pricelist 2 = Wholesale
Is this feasible?
If it is feasible what is the recommended approach?
Current working UDF on Item Master.
/* Date output is based on all the latest updates on the Item Master.*/
select max(updatedate)
from aitm
where itemcode = $[oitm.itemcode]
Resources that were helpful.
1.(Note:1165947 - Tracking Item Price Changes.)
2. Case 4-I6: Query on price updates. Mastering SQL Queries for SAP Business One By: Gordon DuThank you Gordon,
We are looking for the date output of the 'Last Price Update' based on 'Pricelist 2 = Wholesale' which is the challenge.
These 2 are the parameters for the date output, I should have mentioned that in my original message.
Last Price Update
Pricelist 2 = Wholesale
Per reading a bunch of other similar Forum Questions it looked like it is might not be possible to do. With there being no date on the AIT1 table and AITM.Updatedate is based on any and all updates not just last 'Last Price Update' and not sure how to use the loginstanc.
Thanks,
Vern -
Hi, I would like to know how I can automate the output of data collected in CSV format? Manual intervention i.e. output and subsequent Server upload is not efficient. I would like to have the data output, such as a CSV file, as an email attachment which could be "pulled" by my server and integrated into a "CRM" and such like for better data manipulation. Does anyone have any suggestions?
I am sorry but we don't have this facility within Formscentral at this time.
Andrew -
Strange Date Format: April 16, R.O.C. 98 23:11:44 MESZ
Hello,
my Snow Leopard Mail.app suddenly shows me a strange date format:
April 16, R.O.C. 98 23:11:44 MESZ
(also see http://de.tinypic.com/r/153pjpz/3)
My question would be, what does R.O.C. 98 mean and how can I get rid of it?
Thank you very much!
TillReboot solved it. In these times, you don't even think about something this trivial.
-
Reverse data output from Agilent 3458A
I'm taking 500 sub-samples of a 500mS ramp waveform from a function generator with the attached vi, and the data output is reversed in time. That is, the data as displayed on the waveform chart shows the TRAILING edge first - a time-mirror image of the actual waveform captured. I thought this had to do with LIFO/FIFO, so I forced FIFO, but it doesn't help. What must I do to get the proper time-sequence data from the DMM?
Can't seem to attach my vi , but it's identical to the Labview sample Agilent 3458 Acquire Multiple Measurement.vi, with the addition of a VISA Write MEM FIFO.Ok, the data just comes out as an array. Well if you know that the data is backwards, just use Reverse 1D Array (as I already stated) to flip it back.
I remember working with that DMM before. I never found a way to get the data to come out like a FIFO. That's just the way the instrument works. Reverse the array and be done with it.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
SQL pasted below is expected to return dates output in format shown,
with weekday begining 'MONDAY'. The SQL can be ran by creating
a dummy table 'CAL_MONTHS' with one number column with around 200 null rows.
The SQL I have written works fine up to the month and week level but it gets
messed up when trying to print the dates/days for the particular week.
I would greatly appreciate any help.
OUTPUT format I am trying to get:
Month: JAN-2007
================
Week NO. 1
Week-Day Date Day
Monday 1/1 01-JAN-07 01
Tuesday 2/1 02-JAN-07 02
Wednesday 3/1 03-JAN-07 03
Thursday 4/1 04-JAN-07 04
Friday 5/1 05-JAN-07 05
Saturday 6/1 06-JAN-07 06
Sunday 7/1 07-JAN-07 07
Week NO. 2
Week-Day Date Day
Monday 8/1 08-JAN-07 08
Tuesday 9/1 09-JAN-07 09
Wednesday 10/1 10-JAN-07 10
Thursday 11/1 11-JAN-07 11
Friday 12/1 12-JAN-07 12
Saturday 13/1 13-JAN-07 13
Sunday 14/1 14-JAN-07 14 AND SO ON........
Week NO. 3
Week-Day Date Day
Week NO. 4
Week-Day Date Day
Week NO. 5
Week-Day Date Day
Following is the SQL
set serveroutput on
begin
for xx in(
SELECT months v_months, to_date('01-'||months,'DD-MON-YYYY') v_dt
FROM ( SELECT distinct TO_CHAR(days,'MON-YYYY') months
FROM (SELECT to_date('01/01/2007','dd/mm/yyyy') + (ROWNUM-1) days
FROM cal_months
WHERE ROWNUM <= to_number(to_date('01/03/2007','dd/mm/yyyy') - to_date('01/01/2007','dd/mm/yyyy')) +1)
ORDER BY to_date('01-'||months,'DD-MON-YYYY')) loop
dbms_output.put_line(chr(10));
dbms_output.put_line('Month: '||xx.v_months);
dbms_output.put_line(' ================ ');
for xy in(
SELECT distinct
TO_CHAR(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY') ,'IW') -
TO_CHAR(TRUNC(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY') ,'MM'),'IW')+1 week_no
FROM cal_months
WHERE ROWNUM <= TO_CHAR(LAST_DAY(TO_DATE('01-'||xx.v_months,'DD-MON-YYYY')),'DD')) loop
--dbms_output.put_line(chr(10));
dbms_output.put_line(' Week NO. '||xy.week_no);
dbms_output.put_line(' ---------- ');
dbms_output.put_line(' Week-Day Date Day');
dbms_output.put_line(' ------------------------------------------ ');
for zz in(
SELECT
TO_CHAR((TO_DATE('01-'||xx.v_months,'DD-MON-YYYY') -
DECODE(TO_CHAR(TO_DATE('01-'||xx.v_months,'DD-MON-YYYY'),'Dy'),
TO_CHAR(TO_DATE('01-JAN-2007','DD-MON-YYYY'),'Dy'), 0,
TO_CHAR(TO_DATE('02-JAN-2007','DD-MON-YYYY'),'Dy'), 1,
TO_CHAR(TO_DATE('03-JAN-2007','DD-MON-YYYY'),'Dy'), 2,
TO_CHAR(TO_DATE('04-JAN-2007','DD-MON-YYYY'),'Dy'), 3,
TO_CHAR(TO_DATE('05-JAN-2007','DD-MON-YYYY'),'Dy'), 4,
TO_CHAR(TO_DATE('06-JAN-2007','DD-MON-YYYY'),'Dy'),5,
TO_CHAR(TO_DATE('07-JAN-2007','DD-MON-YYYY'),'Dy'), 6)) + (ROWNUM-1) ,'FMDay dd/mm') datee,
'' day, to_date('') the_date
FROM cal_months
WHERE ROWNUM <= DECODE(TO_CHAR(TO_DATE('01-'||xx.v_months,'DD-MON-YYYY'),'Dy'),
TO_CHAR(TO_DATE('01-JAN-2007','DD-MON-YYYY'),'Dy'), 0,
TO_CHAR(TO_DATE('02-JAN-2007','DD-MON-YYYY'),'Dy'), 1,
TO_CHAR(TO_DATE('03-JAN-2007','DD-MON-YYYY'),'Dy'), 2,
TO_CHAR(TO_DATE('04-JAN-2007','DD-MON-YYYY'),'Dy'), 3,
TO_CHAR(TO_DATE('05-JAN-2007','DD-MON-YYYY'),'Dy'), 4,
TO_CHAR(TO_DATE('06-JAN-2007','DD-MON-YYYY'),'Dy'),5,
TO_CHAR(TO_DATE('07-JAN-2007','DD-MON-YYYY'),'Dy'),6)
UNION ALL
SELECT
TO_CHAR(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY'),'FMDay dd/mm') datee,
TO_CHAR(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY'),'dd') day,
TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY') the_date
FROM cal_months
WHERE
ROWNUM <= TO_CHAR(LAST_DAY(TO_DATE('01-'||xx.v_months,'DD-MON-YYYY')),'DD')
and
TO_CHAR(TO_DATE('01-'||xx.v_months,'DD-MON-YYYY'),'MON-YYYY') = xx.v_months
and
TO_CHAR(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY') ,'IW') -
TO_CHAR(TRUNC(TO_DATE(ROWNUM||'-'||xx.v_months,'DD-MON-YYYY') ,'MM'),'IW')+1 = xy.week_no
) loop
dbms_output.put_line(zz.datee||' '||zz.the_date||' '||zz.day); end loop;
end loop;
end loop;
end;Try that:
With weeks of month
declare
vyear number:=2007;
vmes number := 9;
vdays number;
week_day number:=0;
num_day number:=0;
fx date;
begin
vdays := to_char(last_day(to_date(vmes, 'mm')), 'dd');
dbms_output.put_line(to_char(to_date(vmes, 'mm'), 'Mon') || '-' || vyear);
for j in 1..vdays loop
fx := to_date(lpad(j,2,0) || lpad(vmes,2,0) || vyear, 'ddmmyyyy');
if to_char(fx, 'w')!= week_day then
week_day := to_char(fx, 'w');
dbms_output.put_line('Week No.'|| week_day);
dbms_output.put_line('-----------');
dbms_output.put_line('Week_Day Date Day');
dbms_output.put_line('---------------------------');
end if;
num_day := to_char(fx, 'd');
dbms_output.put_line(
to_char(fx, 'Day') || chr(9) ||
to_char(fx, 'dd/mm') || chr(9) ||
to_char(fx, 'dd-Mon-yy') || chr(9) ||
to_char(fx, 'dd')
end loop;
end;
Sep-2007
Week No.1
Week_Day Date Day
Saturday 01/09 01-Sep-07 01
Sunday 02/09 02-Sep-07 02
Monday 03/09 03-Sep-07 03
Tuesday 04/09 04-Sep-07 04
Wednesday 05/09 05-Sep-07 05
Thursday 06/09 06-Sep-07 06
Friday 07/09 07-Sep-07 07
Week No.2
Week_Day Date Day
Saturday 08/09 08-Sep-07 08
Sunday 09/09 09-Sep-07 09
Monday 10/09 10-Sep-07 10
Tuesday 11/09 11-Sep-07 11
Wednesday 12/09 12-Sep-07 12
Thursday 13/09 13-Sep-07 13
Friday 14/09 14-Sep-07 14
Week No.3
Week_Day Date Day
Saturday 15/09 15-Sep-07 15
Sunday 16/09 16-Sep-07 16
Monday 17/09 17-Sep-07 17
Tuesday 18/09 18-Sep-07 18
Wednesday 19/09 19-Sep-07 19
Thursday 20/09 20-Sep-07 20
Friday 21/09 21-Sep-07 21
Week No.4
Week_Day Date Day
Saturday 22/09 22-Sep-07 22
Sunday 23/09 23-Sep-07 23
Monday 24/09 24-Sep-07 24
Tuesday 25/09 25-Sep-07 25
Wednesday 26/09 26-Sep-07 26
Thursday 27/09 27-Sep-07 27
Friday 28/09 28-Sep-07 28
Week No.5
Week_Day Date Day
Saturday 29/09 29-Sep-07 29
Sunday 30/09 30-Sep-07 30
With weeks of years
declare
vyear number:=2007;
vmes number := 9;
vdays number;
week_day number:=0;
num_day number:=0;
fx date;
begin
vdays := to_char(last_day(to_date(vmes, 'mm')), 'dd');
dbms_output.put_line(to_char(to_date(vmes, 'mm'), 'Mon') || '-' || vyear);
for j in 1..vdays loop
fx := to_date(lpad(j,2,0) || lpad(vmes,2,0) || vyear, 'ddmmyyyy');
if to_char(fx, 'ww')!= week_day then
week_day := to_char(fx, 'ww');
dbms_output.put_line('Week No.'|| week_day);
dbms_output.put_line('-----------');
dbms_output.put_line('Week_Day Date Day');
dbms_output.put_line('---------------------------');
end if;
num_day := to_char(fx, 'd');
dbms_output.put_line(
to_char(fx, 'Day') || chr(9) ||
to_char(fx, 'dd/mm') || chr(9) ||
to_char(fx, 'dd-Mon-yy') || chr(9) ||
to_char(fx, 'dd')
end loop;
end;
Sep-2007
Week No.35
Week_Day Date Day
Saturday 01/09 01-Sep-07 01
Sunday 02/09 02-Sep-07 02
Week No.36
Week_Day Date Day
Monday 03/09 03-Sep-07 03
Tuesday 04/09 04-Sep-07 04
Wednesday 05/09 05-Sep-07 05
Thursday 06/09 06-Sep-07 06
Friday 07/09 07-Sep-07 07
Saturday 08/09 08-Sep-07 08
Sunday 09/09 09-Sep-07 09
Week No.37
Week_Day Date Day
Monday 10/09 10-Sep-07 10
Tuesday 11/09 11-Sep-07 11
Wednesday 12/09 12-Sep-07 12
Thursday 13/09 13-Sep-07 13
Friday 14/09 14-Sep-07 14
Saturday 15/09 15-Sep-07 15
Sunday 16/09 16-Sep-07 16
Week No.38
Week_Day Date Day
Monday 17/09 17-Sep-07 17
Tuesday 18/09 18-Sep-07 18
Wednesday 19/09 19-Sep-07 19
Thursday 20/09 20-Sep-07 20
Friday 21/09 21-Sep-07 21
Saturday 22/09 22-Sep-07 22
Sunday 23/09 23-Sep-07 23
Week No.39
Week_Day Date Day
Monday 24/09 24-Sep-07 24
Tuesday 25/09 25-Sep-07 25
Wednesday 26/09 26-Sep-07 26
Thursday 27/09 27-Sep-07 27
Friday 28/09 28-Sep-07 28
Saturday 29/09 29-Sep-07 29
Sunday 30/09 30-Sep-07 30
Maybe you are looking for
-
Win 7 x64 - Need to repair a single driver, but can't use System Restore
Basic Info - an HP/Compaq Elite 8200 Convewrtible Minitower with 2 extra SATA drives & a Creative SoundBlaster card installed. Background: My system had begun going into Blue Screen (BS hereafter) every couple of days with a message that the BIOS wa
-
Can static electricity from a carrying case "blow out" a hard drive?
Can static electricity from a carrying case "blow out" a hard drive? My one-month old MacBook Pro's hard drive died today. The Apple store employee said a number of things could cause it (like dropping it), but I have taken good care of it (never dro
-
I'm a little desperate here... Here's what happened. My MacBook Pro, early 2008, was acting up after upgrading to lion from snow leopard. So I thought I should go ahead and to a clean install since I had just upgraded each time a new os came out. I c
-
MulticastTest for Load balancing issue
Hi, We are currently facing issues with Load balancing using IIS Proxy plug-in. __WebLogicBridgeConfig list of dynamic servers does not return both servers. MulticastTest is the first resolution suggested by Bea Support on this pa
-
Message processing is stopped - Exactly Once Async Abap Proxy
Hi Guys I have two JDBC->Xi->Abap Proxy scenarios. The Abap Proxiy server is in a BW 3.1 with SAP WebAS 6.20 (XI 2.0) and the XI is the XI 3.0 (NetWeaver 2004s). First scenario is synchronous. It works without problem. Second scenario is asynchronous