Update date/time in UNIX timestamp format
The datetime in my Oracle DB is being stored in UNIX Date Time format.
Is there a way I can set the date/time using an UPDATE statement in such a case.
for eg:
select id, creation_date, expiration_date from skel;
id creation_date expiration_date
400019 1213726470
400020 1213733052
400005 1210867973
400018 1213723608
I am looking to set the expiration date as creation_date + 1 year.
Could you please advise?
I am looking to update the value in the field. The values will still be in UNIX date/time format.Yes, but still: instead of continuing converting to Oracle dates and Unix dates, why not just store dates the way the datebase can deal with it the best?
You're probably storing your UNIX date/time formatted dates in the database as NUMBERS.
That is a great loss of lots of built-in date functionality Oracle Database provides.
If you insist on staying on that road, then explore my previous links, you will find your answer:
Convert epoch number to date, do arithmatic and convert the result back to epoch number.
That is overkill.
It won't work/scale/perform/whatever in the end. It is a bad approach.
So, please reconsider this:
Why are you storing dates as numbers?
Convert those numbers to dates once, and be done with it for ever after and benefit from all the builtin date-functionality Oracle database comes with, or convince us that you really have a valid reason to store dates in UNIX date/time format into an Oracle Database.
and my last date was...uuhhmm... never mind ;)
Similar Messages
-
Yahoo email - Updated date/time stuck
Odd one...
for starters, Yahoo push does not work at all for me... no big deal though, I just check it periodically..
Here is the odd part.
Since Monday, when I check my mail, it does receive mail, however, when I look at the time at the bottom for last updated, it is stuck at 7/16/07 3:04pm
I have deleted the account and readded it, I have reset the iphone, and I have cleared out the yahoo inbox... no matter what I do, the 'Last Updated' date & time is stuck at the above, which is quite annoying.
This only occurs in that Yahoo account. Gmail and POP work fine.
I assume this is a bug, but has anyone else experienced this?I gave up on Yahoo. Gmail has been working pretty good for me on the iPhone. Very reliable, I can use my work email ID as a reply-to, doesnt care if its Wifi or EDGE, and the spam filters are top notch. Its free with no advertising (except from happy users like me )
-
How do I update Date Time Digitized to match an updated Capture Time for a DNG file?
I am updating capture time based on GPS Time (a bit OCD, I know) but when I change Capture Time the Date Time Digitized value does not change. This in in LR 4.3 and is not affected by whether on not the Catalog is set to 'Write date or time changes into proprietary raw files'. Maybe this is a problem for DNG files only.
GreSep wrote: I saw another LR discussion that said that with LR 4.3 updating Capture Time would also update Date Time Digitized but it does not do so for me on my DNGs (and as of last month ALL my images were converted to DNGs).
One or two intermediate versions of LR 3 (perhaps Lr 3.6) set DateTimeDigitized when you gave the Metadata > Edit Capture Time command. But for people managing scans in which the capture time of the original image was different than the scan time, this behavior overwrote their scan times, so Adobe backed out of that change. Before and since those versions, the Metadata > Edit Capture Time command just changes the EXIF:DateTimeOriginal and related fields in XMP and IPTC. -
Looking for generic WebService for update date & time in my C# WinForm program
hi
looking for generic WebService for update date & time in my C# WinForm program
thankshi
looking for generic WebService for update date & time in my C# WinForm program
thanks
Hello,
I agree with Cor that since this forum is for issues related to winodws form controls and features, but this issue is mainly related to the webservice which is working for updating time, you could consider posting this issue on other site, or you could
also consider creating your webservice by checking this document
Your first C# Web Service.
If you get any issues when create your webservice, you could post this issue in the following forum.
http://forums.asp.net/28.aspx/1?WCF+ASMX+and+other+Web+Services
Regards.
Carl
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to find the last update date time and user of record field peoplecode
how to find the last update date time record field peoplecode?
Thank you.One can check the last update date time using the following query
SELECT LASTUPDDTTM FROM PSPCMPROG WHERE OBJECTVALUE1 LIKE 'RECNAME' AND OBJECTVALUE2 LIKE 'FIELDNAME' -
Add Last Updated Date/Time to Cube
Is there a way that you can display a date field in EXCEL when a user logs in to a cube so that they can see when the cube was last updated (date/time)? I am currently attaching a note using linked objects but would like to find a more automated solution.
At a previous job, we managed to pick up the system date during the batch and write it into the Database/Set note (from app manager). I can't remember the exact details but pretty sure we used the API.Then people could see when they logged in whether the database had been updated or not.At another place we sent out automated e-mails at the end of each update to those users with access to the database.Ideas only I'm afraid but hope it helps.
-
Cache updated date/time is shown as 1970/01/01
When we checked the cache notification for central adapter engine in the cache monitoring , the cache updated date/time is shown as 1970/01/01.
We have tried to do delta cache refresh and complete cache refresh, but we have not got the intended result. Please look in to the problem and let me know if you have any ideas regarding the same.
regards,
KRUSHIHi
Check for these SM59 in XI ->http connections -><INTEGRATION_DIRECTORY_HMI > ->test the connection. check is it successful or not.
Also you can do the cache refresh from SLD->Administration->Cache Overview -
I want to be able to update the value of a datetime field in
ms sql server to a future date/time.
e.g. if a bidder is placing a pre-auction bid 3 days before
the auction starts i want to change the date & time of this bid
to 1 minute before the auction starts.
<CFSET
Start_Date=#CreateODBCDateTime(GetAuctions.Auction_Date)#>
<CFSET
Start_Time=#CreateODBCTime(GetAuctions.Start_Time)#>
<CFSET Bid_Date=#DateFormat(Start_Date, "yyyy-mm-dd")#>
<CFSET Bid_Time=DateAdd("n", -1, "#Start_Time#")>
<CFSET New_Bid_Date=#DateFormat(Start_Date,
"yyyy-mm-dd")#&' '&#TimeFormat(Bid_Time, "hh:mm:ss.l")#>
<CFQUERY DATASOURCE="#Application.Datasource#"
NAME="UpdateBid">
UPDATE Bids
SET
Bid=<CFQUERYPARAM VALUE="#Form.Bid#"
CFSQLTYPE="CF_SQL_DECIMAL" SCALE="2">,
Bid_Date=<CFQUERYPARAM VALUE="#New_Bid_Date#"
MAXLENGTH="30">
WHERE (Bids.AuctionID=<CFQUERYPARAM
VALUE="#Form.AuctionID#" CFSQLTYPE="CF_SQL_VARCHAR"
MAXLENGTH="50">) AND (Bids.BidID=<CFQUERYPARAM
VALUE="#BidID#" CFSQLTYPE="CF_SQL_INTEGER">)
</CFQUERY>
this does insert the date OK but not the time in 24 hour time
format
e.g. 2008-12-01 02:59:00.000 which has been inserted into the
database should really be 2008-12-01 14:59:00.000
then if i try and add tt to: <CFSET
New_Bid_Date=#DateFormat(Start_Date, "yyyy-mm-dd")#&'
'&#TimeFormat(Bid_Time, "hh:mm:ss.l:tt")#> i get the
following error:
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC SQL Server Driver][SQL Server]Conversion
failed when converting date and/or time from character string.
how can i get the time added as 24 hour?it is for a multi series line graph in a reverse auction.
Currently the pre-auction bids are placed several hours before the
auction starts but then there could be like over 100 bids in an
hour which means the graph gets skewed a bit. the pre-auction bids
are needed to be closer to the starting time of the auction and it
doesnt matter in this case if the pre-auction bids have the exact
same time.
a sample value of the bid_date is 2008-12-02 10:58:56.447
i tried the following in sql:
SELECT CAST(Auction_Date AS Date),CAST(CONVERT(char(8),
dateadd(minute, -1, Start_Time), 108) AS Time)
FROM Auctions
it returned 2 columns - one for the date and one for the time
e.g 2008-12-02 15:59:00.0000000
i then tried:
Update Bids
SET Bid_Date =(SELECT CAST(Auction_Date AS
Date),CAST(CONVERT(char(8), dateadd(minute, -1, Start_Time), 108)
AS Time)
FROM Auctions
WHERE AuctionID='auctionidhere')
WHERE BidID=bididhere
i then get the followng error:
Only one expression can be specified in the select list when
the subquery is not introduced with EXISTS. -
Getting a date as a unix timestamp
Hello everyone,
is the long that is returned by the getTime() method in the date class supposed to be the same as a unix timestamp?
Below I have a time from yesterday, but when i compare this with System.currentTimeMillis(), the currentTime has a smaller timestamp
code]SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy-kk:mm:ss");
long expiryDate=0;
try{
Date d = sdf.parse("11-11-2006-19:07:50");
expiryDate = d.getTime(); results in 1163358470000
catch(ParseException pe){
pe.printStackTrace();
yesterdays time is 1163358470000
current time is 1163355193562 // smaller number
Whats going on?sorry, here it is again
is the long that is returned by the getTime() method in the date class supposed to be the same as a unix timestamp?
Below I have a time from yesterday, but when i compare this with System.currentTimeMillis(), the currentTime has a smaller timestamp
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy-kk:mm:ss");
long expiryDate=0;
try{
Date d = sdf.parse("11-11-2006-19:07:50");
expiryDate = d.getTime(); results in 1163358470000
catch(ParseException pe){
pe.printStackTrace();
}yesterdays time is 1163358470000
current time is 1163355193562 // smaller number
Whats going on? -
if we pass datetime pattern to a selectinputdate control like:
<f:convertDateTime pattern="dd-MMM-yy HH:mm am"/>
it convert the date time as: "1-jan-2008 9:15 am15", that is appending minutes to the am/pm string...
Pls tell how to rectify this problemHi Frank,
It will be great pleasure to me to know the answer from you, whether the same "dd-MMM-yy HH:mm a" solution can be useful in format masking..
And one more question, can u tell me your success mantra, like i am an ardent fan of you.. I wanna become like you in the next 2 years.. Will it be possible for me and if so can u guide me how to master ADF?
Regards,
R N V Prasad. -
Convert date/time to Unix epoch
I have thousands of date time stamps I would like to convert to Unix epoch ten-digit strings. That is, take some thing like:
Dec 9, 2005 10:24 AM
and convert to
1234567890 (only in the correct unix epoch time)
What formula can I use? I've found that this "=DATE(1970,1,1)+P2/86400" can convert a 10 string epoch time down to just a date correctly, but without time. But I need to go in the opposite direction, with the time included.
Using Numbers 09 ver 2.0.5 (368)CP,
An up-to-date Unix Time would be provided by:
=DUR2SECONDS((NOW()-"1/1/1970"))
A somewhat more robust form would be:
=DUR2SECONDS(NOW()-DATE(1970,1,1))
If the time to be converted is in Cell P2, the expression would be:
=DUR2SECONDS(P2-DATE(1970,1,1))
Jerry -
Select entries between two dates by converting Unix timestamp in Oracle Dat
Hi,
I need to select the entries between two dates from an Oracle db. The Oracle db has a column with Unix timestamps. I use the following querry, but it doesnt seem to be working as desired.
select count(*) from reporter_status where to_char(FIRSTOCCURRENCE, 'mm-dd-yy') between ('08-07-06') and ('08-08-06');
FIRSTOCCURRENCE has the Unix timestamps.
Could anyone help me out with this. Thank you for your help.Assuming that it is actually a UNIX timestamp, then it is the number of seconds since Jan 1, 1970, so you need something like:
SELECT COUNT(*)
FROM reporter_status
WHERE TO_DATE('01-Jan-1970', 'dd-mon-yyyy') + (firstoccurrence/24/60/60)
BETWEEN TO_DATE('08-07-2006', 'mm-dd-yyyy') AND
TO_DATE('08-08-2006, 'mm-dd-yyyy');Did Y2K not teach us anything? Use 4 digit years.
John -
Display "Last Updated" date & time in footer?
I share Numbers '09 worksheets over a network with my colleague.
Is there a way to display the date & time of the most recent update (i.e. saved update) in the footer of a worksheet?
I realize this info is available via the Inspector, but it would be very handy to have it printed out along with the data to ensure we are working off the same document revision.Insert > Date & Time into your Header, Footer, Shape, etc.
Right-Click the Date & Time and select Edit Date & Time. In the dialog window that opens, check the box for Automatically Update on Open.
Regards,
Jerry -
How to return start and end time in Unix epoch format
Hi: I have a integer field (utime) in a table that stores the UNIX epoch time for a record. Every sunday around 2:00AM, I am running a query which should return records from last week. I want my condition to have the following in it's where
WHERE utime between
(convert sysdate-7 12:00AM to Unix time)
AND
(convert yesterday 11:59PM to Unix time)
Can someone help me create this convert?
Thanks
RayYes, you seem to have worked out the logic of the expression correctly. Though, in your earlier post you had said that you want records within the range:
WHERE utime between
(convert sysdate-7 12:00AM to Unix time)
AND
(convert yesterday 11:59PM to Unix time)But now you are adding 14400 (4hrs) and deducting 72000 (20hrs) in your expression
SELECT * from TABLE
WHERE utime between
((TRUNC(SYSDATE,'DD')-TO_DATE('01/01/1970','MM/DD/YYYY'))*(24*60*60))+14400 AND
((TRUNC(SYSDATE-6,'DD')-TO_DATE('01/01/1970','MM/DD/YYYY'))*(24*60*60))-72000;Which makes your new condition to be:
WHERE utime between
(convert sysdate 04:00AM to Unix time)
AND
(convert sysdate-7 04:00AM to Unix time)
Are you sure you need records from 4am-to-4am and not midnight-to-midnight? And yes, with BETWEEN condition you need to use expression '<low-value> AND <high-value>' and not '<high-value> AND <low-value>'!
Besides this,
1. You might want to use bind variables rather than hard-coded expressions in your statement. Infact your expression uses SYSDATE, so Oracle would need to get current SYSDATE for each row to evaluate the expression. Which is going to have its impact on performance. As your start-time and end-time values are not dependent on table data maybe you could have a code like this (assuming it is PLSQL code):
start_time constant number := (convert sysdate-7 12:00AM to Unix time);
end_time constant number := (convert yesterday 11:59PM to Unix time);
<DML or Cursor with condition>
WHERE utime between start_time and end_time;
2. You said that your table already has values in unix-epoch-time in column 'utime'. How are these values inserted in the first place? Is there a function in your application that converts any given time to unix-epoch-time? Is yes, then use that in your code.
3. If such a function does not exists, than rather than using hard-coded expressions it might be a good idea to create new functions for converting to and from unix-epoch-time and to get current unix-epoch-time from server.
Using a function in the above case:
start_time constant number := f_convert_to_unix_time( trunc( sysdate-7 ));
end_time constant number := f_convert_to_unix_time( trunc( sysdate )) - 1;
<DML or Cursor with condition>
WHERE utime between start_time and end_time;
And lastly, some of us might not know about Unix time, so here is a useful link http://en.wikipedia.org/wiki/Unix_time -
Inserting and updating date & time in oracle 8i
I am using JDBC thin driver. I am not able to insert date and time in American format.
The best way for you is to use the TO_DATE function. It will allow you to specify the date format.
Maybe you are looking for
-
VGA and HDMI DisplayPort Adapter stoped work on Mountain Lion
Hardware: MBP early 2011 With Mountain Lion 10.8.0 My HDMI adapter stoped working. With Mountain Lion 10.8.1 Both HDMI and VGA adapter stoped working
-
My Ipad mini seems to be locked in one position. I have checked Control Center and it says it is unlocked. I know that the switch on the side can be for the rotation lock or Mute. It is set on Mute so I use the Control Panel. It was working fine and
-
How do i reair the LSP stack of my system
Hi, I have avira antivirus on my computer, but i cannot get web protection working. avira have told me to repair my LSP stack of my system and then perform a repair. How do i repair the LSP stack? what is it? Help!
-
I share an apple id with my cousin and the stuff he bought from iTunes appared in my iTunes today when I downloaded the new version. How do I fix this so it doesn't happen again?
-
How do install new fonts into photoshop?
Trying to add new fonts to my Photoshop. How do I do that?