Convert seconds to date
I was working on this query but I was wondering if there was a way to convert seconds to a date. The program records the number of seconds since January 1, 1960.
SELECT (CLINICALDATE/1000000) "DATE" FROM DOCUMENT WHERE ROWNUM < 6
DATE
1389799659
1406552001
1406553986
1406553986
1406555279
5 rows selected
may be this,
1 with t as
2 (select 1389799659 CLINICALDATE from dual
3 union all
4 select 1406552001 from dual
5 union all
6 select 1406553986 from dual)
7 select (CLINICALDATE)/60/60/24 as days, to_date('01-01-1960','dd-mm-yyyy')old_day,
8 to_date('01-01-1960','dd-mm-yyyy')+ ((CLINICALDATE)/60/60/24) New_day
9* from t
SQL> /
DAYS OLD_DAY NEW_DAY
16085.6442 01-01-1960 00:00:00 15-01-2004 15:27:39
16279.537 01-01-1960 00:00:00 27-07-2004 12:53:21
16279.56 01-01-1960 00:00:00 27-07-2004 13:26:26typo
Message was edited by:
devmiral
Similar Messages
-
Converting seconds value to a date
Hi,
I have date column as integer like 1212638737.Could anyone tell me the way of converting this value to corresponding date value?user11365275 wrote:
I have date column as integer like 1212638737.Could anyone tell me the way of converting this value to corresponding date value?How is the number to be converted to a date? Its not a Julain date because the number is way too big -
i have a the code below which i am passing a form value to
<CFLOCATION
url="CalendarCurrent.cfm?DATE=<cfoutput>#form.Diary_Date#</cfoutput>">
but i am getting cannot convert to a date error, i cannot
change the code below as other pages use it, so how can i change
the cflocation date to match.
i have tried dateformat and lsdateformat any ideas?
<cfif NOT IsDefined("URL.DATE")>
<cfset session.DATE= DateFormat(Now(), "dddd DD MMMM
yyyy")>
<cfset session.SHORTDATE= DateFormat(Now(),
"yyyy-mm-dd")>
<cfelse>
<cfset session.DATE= (DateFormat(URL.DATE, "dddd DD MMMM
yyyy")) >
<cfset session.SHORTDATE= (DateFormat(URL.DATE,
"yyyy-mm-dd")) >
</cfif>Hi,
You didnt understand some basic stuff, so i tell you what you
should have done:
"The value "27/3/2007" could not be converted to a date."
<cfset myDate="form.Diary_Date">
this line you create myDate parameter with value from form,
Diary_Date field.
you should use # signs because coldfusion doesnt know
otherwise you want to use cf parameters value.
in other words otherwise you are telling coldfusion that
mydate is string containing literaly "form..Diary_Date".
take care you always trim parameter values from forms, same
browsers are so nice to adding extra enter character at end of
field value. so first line goes:
<cfset myDate="#Trim(form.Diary_Date)#">
now, sence myDate parameter is fine, lets focus few minutes
how you split value from myDate to tree different pieces.
GetToken fuction is nice fellow when you want split
preformated string to pieces, preformated mean that string always
look same kind. just like dates. year, month and day are in same
positions at string, while year might be different.
example: 1.1.2007 and 1.1.2003, get it?
usage of gettoken is very simple, you just tell function
first parameter where he has to split you piece of string and
second
you tell number of piece to look for and last you tell what
character is separator of each piece.
so, since date you want to process is "27/3/2007", date is
first, month next and year last.
separator is "/" so, getting month should be like this:
myDate is parameter is strinng to be splitted.
number 2 is order number, month is second piece at string
/ is piece separator.
Following code will give you substring "3" from string
"27/3/2007".
<cfset myDate_Month = "#GetToken(myDate,2,"/")#">
Can you repair your self next two lines?
<cfset myDate_Day = "#GetToken(myDate,1,"\")#">
<cfset myDate_Year = "#GetToken(myDate,3,"\")#">
Cheers
Kim -
Inconsistent datatypes: expected INTERVAL DAY TO SECOND got DATE
Hi All,
I am developing a Java application in which I construct a query and pass some values to get the results from the Oracle db.
The code block is:
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(30000);
Date threshold = new Date(calendar.getTimeInMillis());
And when the threshold value is passed, I am getting the following error:
ORA-00932: inconsistent datatypes: expected INTERVAL DAY TO SECOND got DATE
How to convert the threshold value into INTERVAL DAY TO SECOND in java?
Thanks in advance.
Regards,
Bh.So presumably LASTUPDATE is a timestamp column and you pass THRESHOLD as a date, and get something like this:
WITH work_reservations AS
( SELECT TIMESTAMP '2007-07-10 01:23:45' AS lastupdate FROM dual )
SELECT *
FROM work_reservations
WHERE (sysdate - lastupdate) > DATE '2007-01-01';
ERROR at line 5:
ORA-00932: inconsistent datatypes: expected INTERVAL DAY TO SECOND got DATEWhy not just compare lastupdate with threshold? Subtracting a date or timestamp from a timestamp gives an interval.
It might also be marginally more efficient to compare a timestamp with another timestamp, rather than mixing dates and timestamps and incurring an implicit conversion. -
Help with converting hex to date and time
Hi!
I am using snmp4j libraries to walk the mib tree. The system date is getting returned in 11 hexadecimal octets. I require help in converting it to date and time. I looked up the RFC convention of what each octets represent. Require help with conversion.
Eg: 07:db:06:0a:29:1d:00:2b:05:1e
Thanks,Octets Contents Range
1-2 year 0..65536
3 month 1..12
4 day 1..31
5 hour 0..23
6 minutes 0..59
7 seconds 0..60
(use 60 for leap-second)
8 deci-seconds 0..9
9 direction from UTC '+' / '-'
10 hours from UTC 0..13
11 minutes from UTC 0..59
For example I just took the time an hour ago it came out as
07:db:06:13:12:11:1a:00:2b:05:1e
I have to convert this as a date long value to send it.
Do I have to write an utility of my own to do it? -
Hi
I would like to convert seconds to hours -
I have tried the below two -
select to_char(to_date(176400,'SSSSS'),'HH:MI:SS') from dual;
SELECT NUMTODSINTERVAL (176400, 'minute') FROM DUAL;
RegardsHi,
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
Simplify the problem as much as possible. Remove all tables and columns that play no role in this problem.
Always say which version of Oracle you're using.
If you have a number of seconds (s), you can find the equivalent number of hours (h) if you divide s by the number of seconds in an hour, 60 * 60 = 3600.
SELECT s
, s / 3600 AS h
FROM table_x
;H won't necessarily be an integer. If you want an integer, use a rounding function: ROUND, TRUNC, FLOOR or CEIL -
Need to convert the binary data in blob field to readable format
Hi,
We need to convert the Binary data in the BLOB field to readable format and need to display it in Oracle Apps Environment,does anybody come across the similar requirement.
please advise, thanks in advance.
Regards,
Babu.You could use standard Attachments functionality here ... if the blob is not in FND_LOBS, insert into FND_LOBS, fnd_attached_documents etc to enable viewing via "Attachments" to the entity the blob is related to.
Gareth -
Need to Convert Comma separated data in a column into individual rows from
Hi,
I need to Convert Comma separated data in a column into individual rows from a table.
Eg: JOB1 SMITH,ALLEN,WARD,JONES
OUTPUT required ;-
JOB1 SMITH
JOB1 ALLEN
JOB1 WARD
JOB1 JONES
Got a solution using Oracle provided regexp_substr function, which comes handy for this scenario.
But I need to use a database independent solution
Thanks in advance for your valuable inputs.
GeorgeGo for ETL solution. There are couple of ways to implement.
If helps mark -
Convert seconds to [h]:mm:ss format on report text box
I want to convert seconds to hh:mm:ss format on the report text box.
I use =Format(Sum([MyTime])/(24*60*60),"hh:nn:ss"), but it does not work if the hours more than 24 hours, since the format is for the time format for the day.
I need the result shows more than 24 hours, because I want to show how many hours and minutes from my seconds value.
I can use [h]:mm:ss for Excel that it gives me the total hours more than 24 hours.
I tried to use the following to my text box
Int((sum(MyTime)) / 3600) & Format(Int((sum(MyTime) / 60) Mod 60, "\:00") & Format(sum(MyTime) Mod 60, "\:00"),
but for some reason it only shows seconds part without minute and hour part of the value.
Your help and information is great appreciated,
Regards,
Souris,I want to convert seconds to hh:mm:ss format on the report text box.
I use =Format(Sum([MyTime])/(24*60*60),"hh:nn:ss"), but it does not work if the hours more than 24 hours, since the format is for the time format for the day.
I need the result shows more than 24 hours, because I want to show how many hours and minutes from my seconds value.
Hi sourises,
You can use the next function. Place it in a general module.
Function Sec_to_str(seconds)
Dim uur As Integer
Dim min As Integer
Dim sec As Integer
Dim cur_sec As Variant
cur_sec = seconds
If (IsNull(cur_sec)) Then
Sec_to_str = Null
Else
sec = cur_sec Mod 60
cur_sec = cur_sec \ 60
min = cur_sec Mod 60
cur_sec = cur_sec \ 60
uur = cur_sec
If (uur = 0) Then
Sec_to_str = Format(min, "#0") & ":" & Format(sec, "00")
Else
Sec_to_str = Format(uur, "#0") & ":" & Format(min, "00") & ":" & Format(sec, "00")
End If
End If
End Function
Imb. -
Convert String to Date and Format the Date Expression in SSRS
Hi,
I have a parameter used to select a month and year string that looks like: jun-2013
I can convert it to a date, but what I want to do is, when a user selects a particular month-year (let's say "jun-2013")
I populate one text box with the date the user selected , and (the challenge Im having is) I want to populate a text box next to the first text box with the month-year 2 months ahead. So if the user selects
jun-2013 textbox A will show jun-2013
and textbox B will show aug-2013..
I have tried:
=Format(Format(CDate(Parameters!month.Value ),
"MM-YYYY" )+ 2 ) -- But this gives an error
This returns the month in number format like "8" for august...
=Format(Format(CDate(Parameters!month.Value ),
"MM" )+ 2 )
What is the proper syntax to give me the result in this format = "aug-2013" ???
Thanks in advance.
MC
M CollierYou can convert a string that represents a date to a date object using the util.scand JavaScript method, and then format a date object to a string representation using the util.printd method. For more information, see:
http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1254.html
http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1251.html
In your case, the code would be something like:
var sDate = "2013-01-10";
// Convert string to date
var oDate = util.scand("yyyy-mm-dd", sDate);
// Convert date to new string
var sDate2 = util.printd("mm/dd/yyyy", oDate);
// Set a field value
getField("date2").value = sDate2;
The exact code you'd use depends on where you place the script and where you're getting the original date string, but this should get you started. -
Convert Char to Date format - Evaluate
Hi,
Could anyone provide us the Evaluate formula to convert Char to Date format
2009-06-20 should be converted to 06/20/2009
Regards,
VinayHi,
Refer the below threads...
Re: How to convert string to date format?
how to convert character string into date format????
Regards,
Chithra Saravanan -
Convert Char to Date in SQL Server
Hello Experts,
I am trying to convert Char to Date but getting error in Universe designer. Can anybody advise please?
Thanks,
RaviHi,
Try with CAST() and CONVERT() functions. For more information refer use this url : http://msdn.microsoft.com/en-us/library/ms187928.aspx.
It is more easy to get solution if you can post your query.
Cheers,
Suresh Babu Aluri. -
How to Convert internal table data into text output and send mail in ABAP
Hi All,
Good Morning.
Taking a glance at a code that converts internal table data to an Excel file in ABAP. also checked how to send this excel to mailing list as attachment.
But thought of doing it without excel.
I mean, I have an internal table which contains fields of all types (character,integer,date,time). Since it is only around 4 to 5 rows in it (output),why to convert it to excel. not required!!. Instead I want to send this output to User's mails as Normal mail body with No attachments.
Could anybody please suggest me a way as to how to send internal table data as a mail ( not as an excel or PDF etc).
as of now my findings are, it is quite complex to convert internal table data to email (Text) format. but i believe if there is some way of doing it.
Best Regards
Dileep VThere's something I have used in the past where we send out information about failed precalculation settings (which are stored in internal table gt_fail)
notice we use gt_text as "mail body"
TRY.
* -------- create persistent send request ------------------------
gv_send_request = cl_bcs=>create_persistent( ).
* -------- create and set document -------------------------------
* create text to be sent
wa_line = text-001.
APPEND wa_line TO gt_text.
CLEAR wa_line.
APPEND wa_line TO gt_text.
LOOP AT gt_fail ASSIGNING <fs_fail>.
MOVE <fs_fail>-retry_count TO gv_count.
CONCATENATE text-002
<fs_fail>-setting_id
text-003
gv_count
INTO wa_line SEPARATED BY space.
APPEND wa_line TO gt_text.
CLEAR wa_line.
ENDLOOP.
APPEND wa_line TO gt_text.
wa_line = text-007.
APPEND wa_line TO gt_text.
* create actual document
gv_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = gt_text
i_length = '12'
i_subject = 'Failed Precalculation Settings!' ).
* add document to send request
CALL METHOD gv_send_request->set_document( gv_document ).
* --------- set sender -------------------------------------------
gv_sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD gv_send_request->set_sender
EXPORTING
i_sender = gv_sender.
* --------- add recipient (e-mail address) -----------------------
LOOP AT s_email INTO wa_email.
MOVE wa_email-low TO gv_email.
gv_recipient = cl_cam_address_bcs=>create_internet_address(
gv_email ).
CALL METHOD gv_send_request->add_recipient
EXPORTING
i_recipient = gv_recipient
i_express = 'X'.
ENDLOOP.
* ---------- set to send immediately -----------------------------
CALL METHOD gv_send_request->set_send_immediately( 'X' ).
* ---------- send document ---------------------------------------
CALL METHOD gv_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = gv_sent_to_all ).
IF gv_sent_to_all = 'X'.
WRITE text-004.
ENDIF.
COMMIT WORK.
* exception handling
CATCH cx_bcs INTO gv_bcs_exception.
WRITE: text-005.
WRITE: text-006, gv_bcs_exception->error_type.
EXIT.
ENDTRY.
with the following declarations
* TABLES *
TABLES:
adr6,
rsr_prec_sett.
* INTERNAL TABLES & WORK AREAS *
DATA:
gt_fail TYPE SORTED TABLE OF rsr_prec_sett
WITH UNIQUE KEY setting_id run_date,
gt_text TYPE bcsy_text,
wa_fail LIKE LINE OF gt_fail,
wa_line(90) TYPE c.
FIELD-SYMBOLS:
<fs_fail> LIKE LINE OF gt_fail.
* VARIABLES *
DATA:
gv_count(4) TYPE n,
gv_send_request TYPE REF TO cl_bcs,
gv_document TYPE REF TO cl_document_bcs,
gv_sender TYPE REF TO cl_sapuser_bcs,
gv_recipient TYPE REF TO if_recipient_bcs,
gv_email TYPE adr6-smtp_addr,
gv_bcs_exception TYPE REF TO cx_bcs,
gv_sent_to_all TYPE os_boolean.
* SELECTION-SCREEN *
SELECT-OPTIONS:
s_email FOR adr6-smtp_addr NO INTERVALS MODIF ID sel.
DATA:
wa_email LIKE LINE OF s_email. -
How do I convert or send data from a MacBook Pro to an s-video device???
How do I convert or send data from a MacBook Pro to an s-video device??
Use a Mini-Displayport-to-VGA adapter and a conversion box like this:
http://www.amazon.com/PC-To-TV-Video-Converter/dp/B001CJOLBW/ref=pd_cp_e_2
MBP -
Convert TIF Binary data to PDF Binary data
Hi All,
I have uploaded TIF file into table in system in Binary format.
I need to create a spool from this Binary data, the spool should open in TIF format or PDF format.
Can you help me in doing this.
As I knw how to convert PDF to Spool, it would be even helpful, if you tell me how to convert TIF binary data into PDF binay data.
Thanks in advance.
AbhayHi Sandra,
Below is the requirement from Client:
1. PDF and Tif files will be attached to order (transaction CRMD_ORDER).
2. I have to pick the PDF and TIF attachments mentioned above using a batch report.
3. Then this batch report will create a spool for the PDF file and TIF file attachements.
4. Then the spool will be picked by another program and print them together in night.
I hope it is clear now?
Things I have done:
1. Created report ZPDF_TIF which is copy of RSPO0023.
1. Used the report ZPDF_TIF to pick up the PDF and TIF file in binary format from the order (transaction CRMD_ORDER).
2. Able to Convert PDF to spool.
I hve problem for:
1. I want to use the program ZPDF_TIF to work for both PDF and TIF file.
2. I have the TIF data in Binary (1022) into internal table picked using the report ZPDF_TIF.
2. I want to convert TIF to spool which is problem child for me as of now.
I hope the details are clear now.
Maybe you are looking for
-
Iphone 4s not charging or recognized by itunes
HI, I have a Iphone 4s Last week in noticed my ringer is sounding different and the ringer volume is on low and will not go up + or down -.. i wanted to do a back up and factory reset but itune did not recognized it. so i just did a reset on the phon
-
please contact me if you know how i can see where the box is and the phone (when i send it off) i have the case id and carrier tracking number but dont know where to access it ? assuming its a simple answer?
-
Cannot convert character sets for one or more characters Error message
Hello, I am getting this error message "Cannot convert character sets for one or more characters" when i try to transfer the data from Application server file as CSV to PSA. Using T-code AL11 Under SAP Directory I open my file I can able to see all
-
Hi We are in the process of building a customization (not personalization) using OA Framework. Though the UI is going to be different we don't want to rebuild the validations, we want to use the existing validations within apps. If so, what is the be
-
Preferred oracle client installation...
Hi i have installed oracle10g server and now i need to install oracle10g client and need to export it to NFS. So is it preferred to install both in the same machine or different machine. if not which will be the ideal path???? Can u please help me...