Unix time converter
Does anyone have a good unix time converter class
I want to convert a unix time to a UTC time in ss:mm:hh dd,mm,yy
how to do this?
int i = 1061287200;
long t = i * 1000L;
java.util.Date d = new java.util.Date(t);Assumes original time is seconds since some epoch...
Similar Messages
-
How to convert a numeric field representing UNIX time to a standard report
Looking for some help on the creation of a formula that will allow me to convert a numeric string which represent Unix time to a standard date format.
Sample string value "1199149200", Jan 1 2008, 1 AMHi,
Use the DateAdd formula convert Unix epoch to normal datetime (Unix epoch = number of seconds that have elapsed since January 1, 1970).
DateAdd("s", 1199149200, datetime("01/01/1970 00:00:00"))
Cheers,
Fritz -
Convert Epoch (UNIX) time to a readable timestamp
Post Author: uberwolfe
CA Forum: Formula
I am pulling data from a MS SQL 2000 database (for you phone phreaks out there, I am going against the Cisco CallManager CDR database). The datetime stamp is in there as UNIX time. I need to convert and split this into two fields, a date field and a time field. As I have inherited this and don't know a lot about Crystal Reports I am at a loss. Currently the report I have (that a developer who is no longer with us wrote) has two formula's. The formulas are as follows: Time:CTime ({vw_OCESelectionDetail.dateTimeConnect}/8640025569) Date:CDate ({vw_OCESelectionDetail.dateTimeConnect}/8640025569) When the time is returned, it looks to be in GMT. What type of formula would I need to have to convert the time to the correct time within the timezone I am in. Any help would be appreciated.Post Author: uberwolfe
CA Forum: Formula
Gave me an error stating the year needed to be between 1 and 9999. I modified it as such CTime (({vw_OCESelectionDetail.dateTimeConnect} - 21600) / 86400 + 25569)
CDate (({vw_OCESelectionDetail.dateTimeConnect} - 21600) / 86400 + 25569) Running it right now, but it takes a while. Let's see what happens. Will post in a bit. -
Convert unix time stamp to readable time with daylight saving
Hello NG,
I have a table that has a column containing time stamps in the unix time format (seconds since 1970). If I show these times to the user, they should be converted to some readable format. I'm using the following sql code as an example:
select to_char(
to_timestamp_tz(
to_char(
to_date('01011970','ddmmyyyy') + 1/24/60/60 * 1086508800,
'YYYY-MM-DD HH24:MI:SS')||' Europe/Warsaw',
'YYYY-MM-DD HH24:MI:SS TZR'),
'YYYY-MM-DD HH24:MI:SS TZH:TZM')
from dual;
The output I get is the following:
TO_CHAR(TO_TIMESTAMP_TZ(TO
2004-06-06 08:00:00 +02:00
The output is right, but the format I need is the following:
2004-06-06 10:00:00
How do I have to alter the statement to get the correct result (add the two hours of the timezone and dst to the time)?
Any help is appreciated.
Regards,
Mario FreimannThat's the strange thin ... this timezone doesn't exist.
Running the query I get the error message
ORA-01882: timezone-region not found
The results of the statement
select * from V$TIMEZONE_NAMES;
for Europe are:
TZNAME TZABBREV
Europe/Dublin LMT
Europe/Dublin DMT
Europe/Dublin IST
Europe/Dublin GMT
Europe/Dublin BST
Europe/Istanbul LMT
Europe/Istanbul IMT
Europe/Istanbul EET
Europe/Istanbul EEST
Europe/Istanbul TRST
Europe/Istanbul TRT
Europe/Lisbon LMT
Europe/Lisbon WET
Europe/Lisbon WEST
Europe/Lisbon WEMT
Europe/Lisbon CET
Europe/Lisbon CEST
Europe/London LMT
Europe/London GMT
Europe/London BST
Europe/London BDST
Europe/Moscow LMT
Europe/Moscow MMT
Europe/Moscow MST
Europe/Moscow MDST
Europe/Moscow S
Europe/Moscow MSD
Europe/Moscow MSK
Europe/Moscow EET
Europe/Moscow EEST
Europe/Warsaw LMT
Europe/Warsaw WMT
Europe/Warsaw CET
Europe/Warsaw CEST
Europe/Warsaw EET
Possibly something is not right with my installation (Oracle 9.2.0.1.0) ... -
Converting System Time Stamp to Unix Time Stamp
Hi All,
I have a requirement to Convert System Date to Unix Date format.Can any one let me know how to convert system date to Unix Date format. Like function module or any other method.
Regards
Anil Kumar KHi,
I dont know if is this what you want:
http://javascript.internet.com/math-related/unix-date-time-converter.html
Hope it helps! -
VI to convert Unix time to standard time?
hi,
I am in need of a VI to convert Unix time to Standard time?
eg: Unix time: 1268845177 in seconds
Standard time: GMT: Wed, 17 Mar 2010 16:59:37 GMT
Your timezone(U.S):
Wednesday, March 17, 2010 10:59:37 AM
I have the calculation but not full formula.
Unix time is in seconds from Jan 1,1970, 00:00:00 UTC, starting at 0 counting forward.
When 1268845177/86400 = 14685 days.
86400 = 60*60*24 seconds
But how to convert the 14685 days and relate to the current date, how it should be done?
Either the formula or a VI to convert Unix time to standard time will be a help.
Regards,
ArvinthTimestamps and the PC clock vs. time on the net are different and I'd say somewhat unrelated concepts.
You are worried about accuracy of the current time. Timestamps have nothing to do with current time, but are a way of identifying and particular moment in time.
Yes, the PC clock gets its time from the net assuming the time server settings are all set properly. Even the correction of the current PC time may not happen exactly when the leap second gets inserted. It may be some time before the PC resynchronizes with the net time. The PC doesn't know if the existence of when a leap second will occur. And neither does the LabVIEW timestamp.
Here is an example. According to http://en.wikipedia.org/wiki/Leap_second, a leap second will occur at the end of June 30 of this year UTC. Since my clock is eastern daylight time at that date, I put together an example for 8pm on June 30 (UTC +4). You'll see that the 3 values (a second before, the exact time, and a second after) show they are all 1 second apart. There is no extra second accounted for. So in real life the time a second after vs. a second before are actually 3 seconds apart, but LabVIEW only show 2 seconds. Feel free to play with the attached snippet for different timezones and daylight savings time and all of that.
I don't think you really have as big of a problem as you are trying to investigate here. If your timing needs are that critical where you need accuracy of the current time to better than a second, then you shouldn't be looking at LabVIEW timestamps, PC time clock, or internet time at all, but look at a high accuracy timing source perhaps based on a GPS clock.
Unless you have a particular test planned to run over the expected point of time where a leap second is inserted, then you shouldn't have to worry. Even if you do have a test run over the leap second, you probably don't need to worry either. If the test is based on a waveform datatype, then you have a T0 timestamp, and a dT that will keep track of all the individual data points accurately.
Attachments:
Example_VI.png 20 KB -
Dates and convert to Unix Time Stamp using strtotime
I kind of asked this before but now I really need this to work since I'm currently creating a form using the Update Record Form Wizard and the Date Picker to add/update/delete tour dates and this DB was created years ago and uses Unix Time Stamps to enter dates in the DB (example: 1202596733) and I know ADDT's date picker automatically doesn't support that format but there's got to be some way to incorporate the strtotime PHP command into either the add page or the tNG.dispatcher.class.php file. But how? Has anyone experimented with this previously? I was on another forum and they told me to add this:
$timestamp = strtotime($_POST['tourdate']);
to my code but they didn't tell me where and nothing seems to work in making it happen. Anybody got a clue?Hi Sean,
You should be able to simply add the new directory to your include path. But this might fail if relative rather than absolute paths are used
Indeed, ADDT internally uses relative paths at various places, e.g. the file "includes/common/KT_functions.inc.php" has function named KT_getSiteRoot(), where the variable $siteroot has the following value:
dirname(realpath(__FILE__)) . '/../..';
In addition many scripts are defining an absolute path to other scripts, e.g. the Captcha configuration file sets the global variable "KT_CAPTCHA_TEMP_URL" to "includes/common/_temp/.captcha/" -- means that moving the ADDT libraries to a folder like "includes/ssa/" will not work without modifying whatever ADDT script which uses such a hard-coded path, and there are plenty of them.
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
Unix Time Stamp to Date for display
Post Author: merph
CA Forum: Formula
I need to convert a unix time stamp to a readable date for a report. Does anyone outthere have a good formula for this?
Thanks
MerphPost Author: V361
CA Forum: Formula
If you can pull a couple of unix epoch times from the database, then let's run these formulae against them and see if it brings up the correct date and time separately. These formula are pulled from another post by UberWolfe.
ctime(( - 18000) / 86400+25569)
cdate(( - 18000) / 86400+25569)
The 18000 is for to convert for timezones for example 18000 is for -5 GMT. -
hi
i have unixtime format 1075329297.572 how do i store it in database.that is with what datatype.i tried to store unixtime using date, timestamp but it does not work.
but with varchar2 it works. but ifi store with varchar2 i cant perform conversion functions.
i want to convert unix time into yyyy-dd-mm hh-mm-ss format.
help me out
thanks in advancehow to convert julian Date to timestamp datatype in Oracle
-
I'm creating a view whith a column (end_tyd) that has unix time value's that i want to convert to SQL DATETIME 103.
Select
FROM_UNIXTIME(end_tyd)
From myTable
Msg 195, Level 15, State 10, Line 22
'FROM_UNIXTIME' is not a recognized built-in function name.
Hi MVP_88,
As
FROM_UNIXTIME is a function of MySQL, there's no such a built-in function in SQL server. To convert the that column to DATETIME 103 in SQL server, you can reference the below.
DECLARE @end_tyd INT;
SET @end_tyd=1421629632
SELECT CONVERT(VARCHAR(10),DATEADD(SECOND,@end_tyd,'1970-01-01'), 103) AS DATE
/* OUTPUT
DATE
19/01/2015
--In your case
SELECT CONVERT(VARCHAR(10),DATEADD(SECOND,end_tyd,'1970-01-01'), 103) AS DATE FROM yourTable
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
hi,
i am writing a program to convert Unix time in the normal date. I wrote the
following program. The Input is not converted properly to the normal date.
It prints date without any issue but the time is not correct. As per the java docs
about the date constructor the value should be calculated from
01/01/1970 00:00:00 but mine one by default shows 01/01/1970 07:30:00
I don't know from where 07:30 is coming by default.
Looking forward for the suggestions.
import java.io.*;
import java.util.*;
import java.text.*;
public class unixTime{
public static void main ( String [] args ) throws IOException
int dateinsec = 0;
long t = dateinsec * 1000L;
SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Date regDate = null;
regDate = new Date(t);
System.out.println("Formatted date is: " + formatter.format(regDate));
}Thanks.
Corrected thanks
Edited by: vinee on Oct 7, 2008 2:10 AMvinee wrote:
Sorry i didn't check earlier that i posted at the wrong place.
Extremely sorry.No worries. Just don't do it again please.
In the future, if you do post in the wrong place and want to repost the question in the right place, just go back to your original, and provide a reply that says something like "move to" + the URL of your new thread, so there's one coherent discussion and people don't duplicate each others' efforts. -
Hallo,
I am acquiring the data for my reports in a UNIX evironment using embedded SQL.
Therefore I am searching for a function that converts the UNIX time to ORACLE time. Currently I am doing the conversion via a string representation but I would prefer a function that does it on a binary level.
Thanks a lot - Ulrichmaybe (using the link provided) ;)
select case when :unixts between -2114380800 and 2145916799
then TO_DATE('19700101000000','YYYYMMDDHH24MISS') + NUMTODSINTERVAL(:unixts,'SECOND')
end the_date
from dualRegards
Etbin -
Hi all,
We have done the data migration of DFM fault History from the database to Crsytal Report 2008. The data migration is also including a column of date and time. Migration process completed and we noticed on crystal report, the date and time format has changed into 13 digits of unix time format (eg: 1254538573296).
In order to change it to the normal date and time format (eg: mm/dd/yyy 12:34:56 am), we do add a few syntax to the crystal report and we manage to change it. however the problem is, the date and time was appeared wrongly. we
have tried using online converter and after few times we noticed that,if only 10 digits from the unix time is entered, the date and time may appear correctly. Whereas we have 13 digits of unix time that we obtained from the data migration.
Is there any way that we can fix this so that there will only take 10 digits from the database instead of 13 digits?The 13 digits are seen because DFM is written in Java, and Java stores an extra three digits for milliseconds since January 1, 1970. There is no way to export a 10 digit epoch time from DFM. Your post-processing script will need to strip off the trailing three digits to create an epoch time which only includes seconds.
-
Time required in Unix time stamp format
Hello ,
I am new to java as I have recently started working on it.
My requirement is to get current system date in Unix format which is integer(32 bit value) .Is there any class in java which will allow me to do this operation.
Regards
VijaySystem.currentTimeMillis() returns a long (64bit integer) containing the number of milliseconds since Jan 01 1970. The UNIX time format is the number of seconds since Jan 01 1970, so all you need to do is get the time using System.currentTimeMillis(), divide by 1000, and cast it to an int (32 bit integer).
-
Conversion of Unix time to GMT
Does anyone know of a way in which I can turn a date in unix time (no. of seconds since 1st Jan 1970) into a standard GMT format?
Any help would be greatly appreciated.
Thanks!To use GMT time, use TimeZone:
* UnixTime.java
* Created on February 16, 2006, 11:20 AM
* @author Charles Li
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class UnixTime {
public static void main(String[] args) {
GregorianCalendar gc = new GregorianCalendar(TimeZone.getTimeZone("GMT+0"));
long unixTime = 1234567890L; // unix time is second
long ONE_SECOND = 1000L; // 1 second = 1000 millisecond
gc.setTimeInMillis(unixTime*ONE_SECOND);
// 2009/2/13
System.out.println("Year: " + gc.get(Calendar.YEAR));
System.out.println("Month: " + (gc.get(Calendar.MONTH)+1));
System.out.println("Day: " + gc.get(Calendar.DAY_OF_MONTH));
}
Maybe you are looking for
-
'Claim' a Human Task through Workflow API
There is no function to "Claim" a task that is assigned to a group, through Workflow API. There is a function to "Acquire" the task but after acquiring, the task cannot be completed (it throws exception): java.lang.NoClassDefFoundError: com/collaxa/c
-
Sales invoice vf02 enhancement
hi while changing sales Invoice ( vf02 ) ( vf 11 cancellation) , we have a custom requirement, system perform a custom check ( some calculation ) if meets requirment then allow to save change else not allow . what is best way to do this. user exit
-
So your stuck with Labview. Don't let that restrict your choice of DAQ boards. Amplicon provide PC based data acquisition boards with a range of software support, including Labview drivers. Take the ADLink DAQ2200 for example: http://www.amplicon.co.
-
What is stored in 7410 printer memory?
I am trying to understand two things. 1.) What is stored in the memory of the 7410 all in one; and 2.) does unplugging it clear the memory?.
-
I have an Xserve and RAID set up for Network Homes shared over AFP, i need to login as the root on that box, if I log out will people who are connected be disconnected?