Finding epoch seconds for given date.
Hi,
I could able to find out the epoch seconds for particular date in linux using
date -d 'Apr 2 2005 15:31:17' '+%s'
But I am looking for the commands in solaris which does the same work.
I will be thank full if some one could help me.
I tried to do manual......but epoch seconds that I get are differing..
I found following snippet in mktime function
556 unsigned long
557 mktime(const unsigned int year0, const unsigned int mon0,
558 const unsigned int day, const unsigned int hour,
559 const unsigned int min, const unsigned int sec)
560 {
561 unsigned int mon = mon0, year = year0;
562
563 /* 1..12 -> 11,12,1..10 */
564 if (0 >= (int) (mon -= 2)) {
565 mon += 12; /* Puts Feb last since it has leap day */
566 year -= 1;
567 }
568
569 return ((((unsigned long)
570 (year/4 - year/100 + year/400 + 367*mon/12 + day) +
571 year*365 - 719499
572 )*24 + hour /* now have hours */
573 )*60 + min /* now have minutes */
574 )*60 + sec; /* finally seconds */
575 }
but could not make out why 367*mon/12.....instead of 365, I could not locate
the position where previous months days in this year added.
Is 719499 is number of days from 0th year to 1970 ?
Thank you,
Sateesh.
Hi Darren,
Regarding the first option of OS command
date ...'+%s' works in linux only. It will not
work in Solaris. So if I get some command in solaris
which does same work it will be great.Most distributions that use a Linux kernel distribute the gnu 'date' program. That program works the same on Solaris as it does on Linux. That's why I suggested it to you earlier.
# /build/coreutils-5.93/bin/date '+%s'
1177951907
# uname -rsv
SunOS 5.8 Generic_117350-43
Darren
Similar Messages
-
Stock report with value and qauntity for given date not month wise
Hi gems,
can any body give me the standard report for Stock value and qauntity for given date not month wise at storage location levelHi
check the report S_P00_07000139 with the option inventory and raw material report- detail and selection date (from, to date same). List will give opening & closing balances with goods movment and their values.
Thanks -
Is it possible to find the Equipment for given PP work center?
Hello PM Masters,
Is it possible to find the Equipment for given PP work center?
Please tell me which table will lend me the EQUNR when I have the PP work center (ARBPL).
Thank you.Yes,
Provided you maintain this value in Equipment master Location tab like this.
And then query by this field in IH08
Jogeswara Rao K -
Get table partition name dynamically for given date range
Dear All,
Could you please tell me how to get the partition name dynamicaly for given date range ?
Thank you.SQL> select table_name,
partition_name,
to_date (
trim (
'''' from regexp_substr (
extractvalue (
dbms_xmlgen.
getxmltype (
'select high_value from all_tab_partitions where table_name='''
|| table_name
|| ''' and table_owner = '''
|| table_owner
|| ''' and partition_name = '''
|| partition_name
|| ''''),
'//text()'),
'syyyy-mm-dd hh24:mi:ss')
high_value_in_date_format
from all_tab_partitions
where table_name = 'SALES' and table_owner = 'SH'
TABLE_NAME PARTITION_NAME HIGH_VALUE_IN_DATE_FORMAT
SALES SALES_1995 01-JAN-96
SALES SALES_1996 01-JAN-97
SALES SALES_H1_1997 01-JUL-97
SALES SALES_H2_1997 01-JAN-98
SALES SALES_Q1_1998 01-APR-98
SALES SALES_Q2_1998 01-JUL-98
SALES SALES_Q3_1998 01-OKT-98
SALES SALES_Q4_1998 01-JAN-99
SALES SALES_Q1_1999 01-APR-99
SALES SALES_Q2_1999 01-JUL-99
SALES SALES_Q3_1999 01-OKT-99
SALES SALES_Q4_1999 01-JAN-00
SALES SALES_Q1_2000 01-APR-00
SALES SALES_Q2_2000 01-JUL-00
SALES SALES_Q3_2000 01-OKT-00
SALES SALES_Q4_2000 01-JAN-01
SALES SALES_Q1_2001 01-APR-01
SALES SALES_Q2_2001 01-JUL-01
SALES SALES_Q3_2001 01-OKT-01
SALES SALES_Q4_2001 01-JAN-02
SALES SALES_Q1_2002 01-APR-02
SALES SALES_Q2_2002 01-JUL-02
SALES SALES_Q3_2002 01-OKT-02
SALES SALES_Q4_2002 01-JAN-03
SALES SALES_Q1_2003 01-APR-03
SALES SALES_Q2_2003 01-JUL-03
SALES SALES_Q3_2003 01-OKT-03
SALES SALES_Q4_2003 01-JAN-04
28 rows selected. -
SD pricing extract for given date range
Hi,
Is any one knows any FM where you can able to extract pricing for given date range.
FM Pricing works for one date. I don't want to loop at this
FM for the given date rage. It takes very long time.
Thanks for any suggestion.
Kind Regards
NirHi,
Is any one knows any FM where you can able to extract pricing for given date range.
FM Pricing works for one date. I don't want to loop at this
FM for the given date rage. It takes very long time.
Thanks for any suggestion.
Kind Regards
Nir -
Last Purchase price Warehouse wise for given date
Hai all....
I Want query report for Last purchase price for all items, warehouse wise for given date, i tried following query
SELECT
T10.ItemCode,
(Select i1.Itemname from oitm i1 where i1.itemcode = T10.[ItemCode]) as 'ItemName',
T10.[Whscode],
(SELECT T1.[DocDate] FROM OPDN T1 where T1.[DocEntry] = max(T10.[DocEntry])) as 'Doc_Date',
(SELECT T1.[DocNum] FROM OPDN T1 where T1.[DocEntry] = max(T10.[DocEntry])) as 'GRPO_NO',
(SELECT case avg(T2.[Rate]) when 0 then avg(T2.[price]) else (avg(T2.[price]) * isnull(avg(T2.[Rate]),1)) end FROM PDN1 T2 where T2.[DocEntry] = max(T10.[DocEntry])
and T2.Itemcode = T10.[ItemCode]) as 'Unit_Price',
(SELECT isnull(avg(T3.[Rate]),0) FROM PDN1 T3 where T3.[DocEntry] = max(T10.[DocEntry])
and T3.Itemcode = T10.[ItemCode]) as 'CurrencyRate',
(Select isnull(max(OP1.Docnum),0) from OPCH op1 where op1.Docentry in
(SELECT T12.[trgetEntry] FROM PDN1 T12 where T12.[DocEntry] = max(T10.[DocEntry]))) as 'Invoice_No'
FROM PDN1 T10
INNER JOIN OPDN T11 ON T10.DocEntry = T11.DocEntry and T11.[DocType] = 'I'
where T11.Docdate <= '[%0]' and t10.targettype <> 21
GROUP BY
T10.[ItemCode],T10.[Whscode]
this query working good but problem in this query is ,when the user put back dated entry means this report will show wrong value,bcz i write this query based on MAX of docentry please help me to solve this issue
Edited by: Prasanna s on Mar 27, 2009 5:49 AM
Edited by: Prasanna s on Mar 27, 2009 8:00 AMHai ...
please help me in this query,my question is not clear or?? -
Where to find best practices for tuning data warehouse ETL queries?
Hi Everybody,
Where can I find some good educational material on tuning ETL procedures for a data warehouse environment? Everything I've found on the web regarding query tuning seems to be geared only toward OLTP systems. (For example, most of our ETL
queries don't use a WHERE statement, so the vast majority of searches are table scans and index scans, whereas most index tuning sites are striving for index seeks.)
I have read Microsoft's "Best Practices for Data Warehousing with SQL Server 2008R2," but I was only able to glean a few helpful hints that don't also apply to OLTP systems:
often better to recompile stored procedure query plans in order to eliminate variances introduced by parameter sniffing (i.e., better to use the right plan than to save a few seconds and use a cached plan SOMETIMES);
partition tables that are larger than 50 GB;
use minimal logging to load data precisely where you want it as fast as possible;
often better to disable non-clustered indexes before inserting a large number of rows and then rebuild them immdiately afterward (sometimes even for clustered indexes, but test first);
rebuild statistics after every load of a table.
But I still feel like I'm missing some very crucial concepts for performant ETL development.
BTW, our office uses SSIS, but only as a glorified stored procedure execution manager, so I'm not looking for SSIS ETL best practices. Except for a few packages that pull from source systems, the majority of our SSIS packages consist of numerous "Execute
SQL" tasks.
Thanks, and any best practices you could include here would be greatly appreciated.
-EricOnline ETL Solutions are really one of the biggest challenging solutions and to do that efficiently , you can read my blogs for online DWH solutions to know at the end how you can configure online DWH Solution for ETL using Merge command of SQL Server
2008 and also to know some important concepts related to any DWH solutions such as indexing , de-normalization..etc
http://www.sqlserver-performance-tuning.com/apps/blog/show/12927061-data-warehousing-workshop-1-4-
http://www.sqlserver-performance-tuning.com/apps/blog/show/12927103-data-warehousing-workshop-2-4-
http://www.sqlserver-performance-tuning.com/apps/blog/show/12927173-data-warehousing-workshop-3-4-
http://www.sqlserver-performance-tuning.com/apps/blog/show/12927061-data-warehousing-workshop-1-4-
Kindly let me know if any further help is needed
Shehap (DB Consultant/DB Architect) Think More deeply of DB Stress Stabilities -
How to get organisation unit for given date.
Hi Everyone,
I have created a report to display all the hired and left employees
for the given date. I have to display department wise.
CALL FUNCTION 'RH_DIR_ORG_STRUC_GET'
EXPORTING
ACT_ORGUNIT = S1_ORGEH-LOW
ACT_PLVAR = '01'
ACT_DATE = SO_DATE-HIGH
SORT_FLAG = 'X'
ADD_FLAG_PDATA = 'X'
TABLES
ORG_UNITS = IT_ORG_UNITS.
This function module will bring all the active org unit existing
in our system. If an organisation unit is delimited.
This function module is not getting the delimited org unit.
How to get that org unit.
Plz its vry urgent,
thanks in advance,
regards,
stanleydid you try RH_STRUC_GET?
Regards
Raja
close your previous threads
Re: ALV in browser -
Need FM to find physical path for given logical path
Hi Guru's,
I wanted to find the physical path for the given the logical path.
I have a requirement where i have to write records into the file mentioned via logical path .Inside the program i wanted to fetch the physical path for given logical path .
Is there any FM to achieve this functionality.
Thanks!!
PraveeUse fm FILE_GET_NAME to get physical file name from a logical file name. But u have to maintain the mapping between logical file name and physical file name in tran. FILE.
call function 'FILE_GET_NAME'
exporting
logical_filename = lds_name << Logical file name
importing
file_name = ds_name << Physical file name
exceptions
file_not_found = 01.
Regards,
Joy. -
Finding Column Name for a Data Pattern
Hi all,
I want to find out all the column names which is having matching data pattern such as 'Football'
I want to get all those column names whose data matches value 'FootBall'
Which Data Dictionary i can find out column name with data value
Pls advice
ThanksDefinitely a strange requirement but hey....
SQL> ed
Wrote file afiedt.buf
1 declare
2 cursor cur_tables is
3 select table_name from user_tables order by 1;
4 cursor cur_columns(p_table IN VARCHAR2) is
5 select column_name from user_tab_columns
6 where data_type IN ('CHAR', 'VARCHAR2')
7 and table_name = p_table;
8 v_cnt NUMBER;
9 v_sep VARCHAR2(10);
10 v_where VARCHAR2(2000);
11 v_word VARCHAR2(30) := 'FOOTBALL';
12 begin
13 DBMS_OUTPUT.ENABLE(1000000);
14 FOR t IN cur_tables
15 LOOP
16 v_sep := ' WHERE ';
17 v_where := NULL;
18 FOR c IN cur_columns(t.table_name)
19 LOOP
20 v_where := v_where||v_sep||c.column_name||' LIKE ''%'||v_word||'%''';
21 v_sep := ' OR ';
22 END LOOP;
23 IF v_where IS NOT NULL THEN
24 EXECUTE IMMEDIATE 'SELECT count(*) FROM '||t.table_name||v_where INTO v_cnt;
25 IF v_cnt > 0 THEN
26 DBMS_OUTPUT.PUT_LINE(v_word||' is in table '||t.table_name);
27 END IF;
28 END IF;
29 END LOOP;
30* end;
SQL> /
FOOTBALL is in table ADDRESS
FOOTBALL is in table LOGTEXT
FOOTBALL is in table NOMINAL
PL/SQL procedure successfully completed.
SQL> -
Discovering the day of the week for given date
hi guys, im trying to discover the day of the week for a given date when i do this it works fine:
select to_char(sysdate,'FMDAY') from dual
however, when i try to pass in my own value as a parameter i get the error: invalid number
select to_char(:mydate,'FMDAY') from dual .
the value im passing through to mydate is 21/02/2011 so i have no idea why it is not working. Any help would be greatly appreciated. thanks
Edited by: 786733 on 21-Feb-2011 03:41786733 wrote:
hi guys, im trying to discover the day of the week for a given date when i do this it works fine:
select to_char(sysdate,'FMDAY') from dual
however, when i try to pass in my own value as a parameter i get the error: invalid number
select to_char(:mydate,'FMDAY') from dual .
the value im passing through to mydate is 21/02/2011 so i have no idea why it is not working. Any help would be greatly appreciated. thanksyou're probably passing in a string instead of a date, so you need to convert it to a date with the appropriate format.
select to_char(to_date(:mydate,'DD/MM/YYYY'),'FMDAY') from dual -
Find material Stock to given date
I have been asked to customize the standard report transaction MB5L. I have created ZPROGRAM for the report. I have an input field for date to get material stock till that date.How can i calculate material stock till the given date ?
Basically you will have to use
An "historical" table with stock at end of periods
- MBEWH Material Valuation: History
- MARDH Material Master Storage Location Segment: History
etc.
A "flow" table for movement before last period recorded and date asked for
- MSEG/MKPF Document Segment: Material
- BSIM Secondary Index, Documents for Material
<i>(Use MSEG/MKPF for quantities and BSIM for valuations its easier than matching the two files, valuation can vary without movement in MSEG and some movement in MSEG don't reflect in accounting)</i>
Regards -
Help reqd for finding TAXES & CONDITIONS FOR GIVEN PO IN SAP-SCRIPT
HI ALL,
Currently iam working on SAP-SCRIPT developing PO in that i displayed fields like EMATN TYPE EKPO-EMATN,( material no. )
TXZ01 TYPE EKPO-TXZ01, ( long text )
MEINS TYPE EKPO-MEINS, ( units )
MENGE TYPE EKPO-MENGE (quantity)
now i want to display taxes & conditions for given ematn no.( material no . ) so from which tables i should get the data how to display. plz help me.
thanks in advance.
Regards,
mahesh dudamHi !!
for this please study teh following extract :
All pricing values are maintained in the KONV table for the respective pricing condition . Extract these values from KONV table by passing EKKO-KNUMV values for the Purchase order number from the EKKO purchase order header table .
************************************************************************88
FORM GET_PRICING_DATA USING P_KNUMV.
SELECT * INTO TABLE I_KONV
FROM KONV
WHERE KNUMV = WA_EKKO-KNUMV.
IF SY-SUBRC = 0.
SORT I_KONV.
ENDIF.
ENDFORM. " GET_PRICING_DATA
*& Form get_tax_details
extract Tax item details.
-->P_EBELp for purchase order item.
FORM GET_TAX_DETAILS USING P_EBELP.
DATA : L_OCTROI LIKE KONV-KWERT,
L_BASE LIKE KONV-KWERT,
L_OTHERS LIKE KONV-KWERT,
L_DISCOUNT LIKE KONV-KWERT,
L_PFORWARD LIKE KONV-KWERT,
L_INSU LIKE KONV-KWERT,
L_NUM LIKE I_KONV-KUMZA VALUE 1,
L_DENO LIKE I_KONV-KUMNE VALUE 1,
L_KPEIN LIKE KONV-KPEIN VALUE 1,
L_FRT LIKE KONV-KWERT,
L_CHAR(15).
*-- getting numerator and denominator for base value.
READ TABLE I_KONV WITH KEY KSCHL = 'PBXX'.
IF SY-SUBRC = 0.
L_NUM = I_KONV-KUMZA.
L_DENO = I_KONV-KUMNE.
L_KPEIN = I_KONV-KPEIN.
ELSE.
READ TABLE I_KONV WITH KEY KSCHL = 'PB00'.
IF SY-SUBRC = 0.
L_NUM = I_KONV-KUMZA.
L_DENO = I_KONV-KUMNE.
L_KPEIN = I_KONV-KPEIN.
ELSE.
READ TABLE I_KONV WITH KEY KSCHL = 'P001'.
IF SY-SUBRC = 0.
L_NUM = I_KONV-KUMZA.
L_DENO = I_KONV-KUMNE.
L_KPEIN = I_KONV-KPEIN.
ELSE.
READ TABLE I_KONV WITH KEY KSCHL = 'P000'.
IF SY-SUBRC = 0.
L_NUM = I_KONV-KUMZA.
L_DENO = I_KONV-KUMNE.
L_KPEIN = I_KONV-KPEIN.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CLEAR : V_OCTROI,V_OTHERS, V_DISCOUNT,V_PFORWARD,V_INSU,V_FTR.
LOOP AT I_KONV WHERE KPOSN = P_EBELP.
*-- Considering the numerator denominator and UOPricing
IF I_KONV-KPEIN = 0 .
I_KONV-KUMZA = 1. " Numerator
I_KONV-KUMNE = 1. " Denominator
I_KONV-KPEIN = 1. " Unit of pricing
ENDIF.
IF NOT I_KONV-KWERT IS INITIAL .
IF I_KONV-KRECH = 'C' AND I_KONV-KSCHL <> 'PB00'
AND I_KONV-KSCHL <> 'PBXX'.
I_KONV-KWERT = ( I_KONV-KWERT * I_KONV-KUMZA )
* L_KPEIN / ( I_KONV-KUMNE * I_KONV-KPEIN ).
ELSEif I_KONV-KRECH = 'C' AND I_KONV-KSCHL = 'PB00'
AND I_KONV-KSCHL = 'PBXX'.
I_KONV-KWERT = ( I_KONV-KWERT * L_NUM * L_KPEIN ).
/ ( L_DENO ).
elseif I_KONV-KRECH = 'A' AND I_KONV-KSCHL = 'PB00'
AND I_KONV-KSCHL = 'PBXX'.
I_KONV-KWERT = ( I_KONV-KWERT * L_NUM * L_KPEIN )
/ ( l_deno ).
ENDIF.
ENDIF.
CASE I_KONV-KSCHL.
*-- For base price
WHEN 'PB00'.
L_BASE = L_BASE + I_KONV-KWERT.
WHEN 'PBXX'.
L_BASE = L_BASE + I_KONV-KWERT.
WHEN 'P000'.
L_BASE = L_BASE + I_KONV-KWERT.
WHEN 'P001'.
L_BASE = L_BASE + I_KONV-KWERT.
*-- For octroi
WHEN 'JOCM'.
L_OCTROI = L_OCTROI + I_KONV-KWERT .
*-- For discount calculation
WHEN 'ZDT%'.
L_DISCOUNT = L_DISCOUNT + I_KONV-KWERT .
WHEN 'ZDN%'.
L_DISCOUNT = L_DISCOUNT + I_KONV-KWERT.
WHEN 'ZDTV'.
L_DISCOUNT = L_DISCOUNT + I_KONV-KWERT .
WHEN 'ZDNV'.
L_DISCOUNT = L_DISCOUNT + I_KONV-KWERT.
*--- For packing forwarding .
WHEN 'ZPNV'.
L_PFORWARD = L_PFORWARD + I_KONV-KWERT.
WHEN 'ZPN%'.
L_PFORWARD = L_PFORWARD + I_KONV-KWERT.
*--- For frieght .
WHEN 'ZFTV'.
L_FRT = L_FRT + I_KONV-KWERT.
WHEN 'ZFT%'.
L_FRT = L_FRT + I_KONV-KWERT.
WHEN 'ZFNQ'.
L_FRT = L_FRT + I_KONV-KWERT.
**-----for others
WHEN 'ZOTV'.
L_OTHERS = L_OTHERS + I_KONV-KWERT.
WHEN 'ZOT%'.
L_OTHERS = L_OTHERS + I_KONV-KWERT.
WHEN 'ZOTP'.
L_OTHERS = L_OTHERS + I_KONV-KWERT.
WHEN 'ZONV'.
L_OTHERS = L_OTHERS + I_KONV-KWERT.
WHEN 'ZON%'.
L_OTHERS = L_OTHERS + I_KONV-KWERT.
WHEN 'ZONP'.
L_OTHERS = L_OTHERS + I_KONV-KWERT.
*--- for insurance
WHEN 'ZINV'.
L_INSU = L_INSU + I_KONV-KWERT.
WHEN 'ZIN%'.
L_INSU = L_INSU + I_KONV-KWERT.
WHEN OTHERS.
CONTINUE.
ENDCASE.
CLEAR I_KONV.
ENDLOOP. -
Finding some tool for loading data
I will finding some tools for loading, migrate
data from another dbms like Access, DBF Files, Excel
to Oracle Database
Please suggess me
Thank you
KachornsakI suppose the various sources will have various optimal solutions.
Like in case you want to import from excel I would suggest to save your data to a csv and use import. (imp)
For access files the best solution is the Oracle Migration Workbench.
Best Regards,
Kris -
Formula variable to find week name for a date
hi,
i want to get the week name for a date value and i want to do this in query designer.can anybody tell me whther ican create any formula variable for this and if yes how can i do it???y dont use text varaible processing by customer exit
Maybe you are looking for
-
Synching 2 3Gs iPhones to one iTunes account on one computer
I have a few questions regarding synching two 3Gs iPhones with one iTunes account on one computer. I had synched both phones (mine and my wifes) to our desktop computer but saw that apps were being placed on both of our phones and contacts were being
-
When is the next update comming?
Does anyone have a hint? I am having tremendous problems on an non Sony android 5 device and really would like to see some changes. Is there going to be one more update before Android 5 is being released mid-end of march?
-
Hi Support, I am trying to use FMLE to encode and stream video from an Axis P1346 IP camera, via Axis' Streaming Assistant software, to a Wowza server. Everyting appears to be working perfectly and the encoding and resultant stream quality is excelle
-
Finder won't run/Hard Drive won't mount on restart!!?!
Hey all. Restarted my Powerbook G4 on OSX 10.4.10 yesterday, and for some reason, the Finder does not run, and the HardDrive icon does not appear. My top bar appears partially, and my Dock appears with all my programs, but the desktop is empty!?! Som
-
Unable to connect, 'network connection was reset.'
I have been unable to connect with the itunes store despite an extreme effort and multiple changes/attempts. I do have sonic wall firewall running McAfee anti virus. Everytime I open itunes I get the message: "itunes could not connect to the itunes s