Converting time stamp in SECONDS to a calendar date format.. problems

Hello. I'm trying to convert a long interger that represents the number of SECONDS passed since the 1970 date
the number was originally generated by php's mktime() function
one of the numbers I have for example is this : 1126933200
I haven't done the math but this is a date probably around september of 2005.. it's irrelevant anyhow.
I want to convert this to a date format I can use in java. I've tried to create a new date like so :
Date date = new Date(1126933200);
I've also tried it with the calendar method like so :
Calendar calendar = new GregorianCalendar();
calendar.setTimeInMillis(1126933200);
it was only then that I realized that both these methods require the number of MILLI seconds. So I tried doing a simple multiplication by 1000 on my original number and then I started getting a "integer number too large" error when trying to compile.
so i'm kind of at a loss here.. i figure I could make a function myself that would divide my number in days of 86400 seconds.. and then i'd have to keep in mind the bisectal (sp) and the months with more and less days etc.. but i'm sure there must be an easier way.
and i don't get why a method who's meant to receive a very long number is giving me an error when i try to give one to it.
your help is appreciated as always. thanks

Hello. I'm trying to convert a long interger that
represents the number of SECONDS passed since the
1970 date
the number was originally generated by php's mktime()
function
one of the numbers I have for example is this :
1126933200
I haven't done the math but this is a date probably
around september of 2005.. it's irrelevant anyhow.
I want to convert this to a date format I can use in
java. I've tried to create a new date like so :
Date date = new Date(1126933200);
I've also tried it with the calendar method like so
Calendar calendar = new GregorianCalendar();
calendar.setTimeInMillis(1126933200);
it was only then that I realized that both these
methods require the number of MILLI seconds. So I
tried doing a simple multiplication by 1000 on my
original number and then I started getting a "integer
number too large" error when trying to compile.So you needed to add L to one of the numbers.
Note you also need to define what timezone that seconds number represents.
With Gregorian it is going to use the local timezone (the code here will anyways). The code using Date is using the UTC timezone.

Similar Messages

  • How to convert time stamp to time in update rule

    Anybody know how to convert time stamp to time only?  Any FM that I can use?
    time stamp example
    20010203100201
    Result:
    10:02:01
    Thank
    Sudree

    Please search the forum

  • Error when converting time stamp in date time time zone CST  in IC

    Hi Experts,
    We have recently upgraded from CRM 5.0 to CRM 2007. We are using IC WEB Employee interaction center.
    so when agent create service ticket in interaction center and close the ticket on same day we are getting an error saying Error when converting time stamp in date time time zone CST.
    we thought there may be problem while installing SAP CRM by basis team in time zone, but we did not find any problem.
    So please advice how to resolve this issue.
    Regards,
    Teja

    Hi Teja,
    I saw a similar message, and it was resolved by adding a timezone to the user profile defaults tab in SU3. I believe the system has been configured to convert between users' timezone and the system timezone, therefore it needs to know each users' timezone.
    Regards,
    Simon.

  • How to change calendar date format

    Hi All,
    I want to change the calendar date format to YYYY-MM-DD . For that i did the changes in localedefinitions.xml file but the date format i am getting is YYYY-M-D (if the month and date is single digit no else i am getting YYYY-MM-DD).
    Example - 2010-9-1
    we need - 2010-09-01
    Which file we need to modify to get the date alway in YYYY-MM-DD format.
    Thanks..

    hi,
    How about this?
    http://108obiee.blogspot.com/2009/04/changing-date-format-mask-in-javascript.html
    or
    http://obieetalk.com/how-change-date-format-mask-date-dashboard-prompts-drop-down-list-and-calendar
    thanks,
    Saichand.v

  • Calendar date format

    Helo, I have i question how to change calendar date format, for example now when i'm press on date i got 2014 May 28 how can I change that when i'm press on date i  will get 2014-05-28?

    Hi Edgaras
    For date formatting you can implement below mentioned code. Check the highlighted function
    template : new sap.ui.commons.TextView( {                                                                              textAlign : 'Left'}) .bindProperty("text",  {path: <field_name>,formatter: function(oValue){
    if (oValue) {  var d = new Date(oValue);                    
      return sap.ui.core.format.DateFormat.getDateInstance( {style:"full", pattern: "yyyy-MM-dd"}).format(d); }}} ),           
    Nabheet

  • Converting time stamp in waveform to seconds

    Hello,
    I would like to convert the time stamp in a waveform (coming from 'AI Sample Channel') into seconds.  Currently when I read the waveform into a file I get a format that looks like
    18:00:47.453000
    Any help you can offer would be greatly appreciated, it seems like this should be easy to do?
    Thanks,
    Cullen

    In the attached example, I compare converting the datestamp to seconds by converting to double, to extended precision and doing a delta directly on the timestamp iteself (then converting). 
    Running the VI showed the same results (using Win-XP) for all three cases.  Unless you have a better OS, then the top example would probably do.
    At least the example will show you how to convert to seconds (in 50ms steps for the example), and how to do it using the array directly (polymorphic functions).
    Hope it helps,
    RayR
    Attachments:
    DeltaTime.vi ‏13 KB

  • Time stamp dropping seconds

    I figure someone has had this problem before but didn't see it in the forum anywhere.  I'm adding a time stamp to a file so I've used the "Get Time/Date in Seconds" and wired that to a "Convert to DBL".  This then wires both into an indicator on the Front Panel and into the "Write to Measurement File" Express VI.
    The indicator displays the time stamp just fine but in the file it puts it into scientific notation and cuts off the last 4 digits as well as any fractional seconds.  The time stamp writes to the file every 5 seconds so it is important to have the rest of the time stamp included.  I've tried using probes on the wires to see where things go weird but I get the same truncated value in the wire before and after the indicator.  I thought it had something to do with the Express VI first since the indicator is fine but with it truncated in the wire it seems that the Express VI is indeed saving exactly what is handed to it...but then again the indicator...you can see I've been running in circles over this!  Does anybody know the reason it is doing this and a possible solution?
    Thanks a lot!
    Solved!
    Go to Solution.

    I can't post the exact code because it is being developed for use outside our lab but I've recreated the basics of the problem.  The array would be the collected data and except some filename details and things like that everything relevant to the time and saving is included.  Also settings in the express VI are the same.  Not sure if it will help out.
    Attachments:
    example.vi ‏56 KB

  • Time stamps in Seconds from Epocho

    Hi,
    I have a requirement, where I need to calculate the Time stamp for sy-datum.
    That is. I have to calculate the number of seconds from 01/01/1970.
    www.unixtimestamp.com
    gives more infor. But how do I do this in my report?

    Hi Jurgeon,
    The function module I used is 'L_MC_TIME_DIFFERENCE'. This gives time difference between two dates and time in minutes. I later converted this to seconds by multiplying by 60.
    Thanks for your suggestion.
    Thanks,
    Chaith.

  • Datge/time stamp on printout of Month calendar

    Is there any way to automate having the date and time of when I printed it, show up on a monthly calendar printout?

    Hello. I'm trying to convert a long interger that
    represents the number of SECONDS passed since the
    1970 date
    the number was originally generated by php's mktime()
    function
    one of the numbers I have for example is this :
    1126933200
    I haven't done the math but this is a date probably
    around september of 2005.. it's irrelevant anyhow.
    I want to convert this to a date format I can use in
    java. I've tried to create a new date like so :
    Date date = new Date(1126933200);
    I've also tried it with the calendar method like so
    Calendar calendar = new GregorianCalendar();
    calendar.setTimeInMillis(1126933200);
    it was only then that I realized that both these
    methods require the number of MILLI seconds. So I
    tried doing a simple multiplication by 1000 on my
    original number and then I started getting a "integer
    number too large" error when trying to compile.So you needed to add L to one of the numbers.
    Note you also need to define what timezone that seconds number represents.
    With Gregorian it is going to use the local timezone (the code here will anyways). The code using Date is using the UTC timezone.

  • Converting time stamp to double

    Hello,
    I am currently using the write to spreadsheet file.vi to save data.
    It looks something like this:
    I also want to add the date and time stamp into the saved data but do not know a way of converting a date and time stamp to 'double format'. When the date and time stamp is in teh double format I can easily concatenate the data stream with the 'date and time' in a 2-D array.
    Thanks,
    Nevica

    Duplicate post
    http://forums.ni.com/t5/LabVIEW/converting-time-st​amp-to-double/td-p/1181397
    Tim
    Johnson Controls
    Holland Michigan

  • How to Convert Time Stamp to String for Filename use

    I'm writing an Labview application in which I would like to convert pull time stamp infor from Time Stamp VI and convert to string so I can use to append as part of filename.
    The fomat that I want may look something like basefilename081208_1300.  This would represent a file name that has elements consisting of the date 08/12/08 and 13:00 hours zulu.
    Paul 

    Hello:
    Use the Format Date/Time String VI, and use as the format string the following: %d%m%y_%H%M
     This way you'll get the date string you want. 
    Then concatenate the output to other strings you need to name your file.
    I've attached an screenshot.
    Hope this helps.
    Robst.
    Robst - CLD
    Using LabVIEW since version 7.0
    Attachments:
    datetime string.JPG ‏20 KB

  • Convert Time Stamp to String

    What is the most efficienct way to convert a Time Stamp Control to a MM/DD/YYYY string? I am going to use its output as date parameters to a WHERE clause to a SQL Server query.
    Solved!
    Go to Solution.

    Eric1977 wrote:
    Jeff,
    I just did it like this. Do you forsee any problems?
    Well, what is the output? Do you foresee a problem? The LabVIEW Help is quite clear on the format. The very first sentence of the Help file for the Format Date Time String provide a link to the codes: http://zone.ni.com/reference/en-XX/help/371361H-01​/glang/codes_for_time_format_str/

  • To convert time stamp (data element ARFCTIME (char 8)) into date and time

    Hi All,
    ARFCSDATA table stores time stamp value like 41C9EC9D or 41D2DA75 (in char8 format)...how to convert it to date & time?
    Thanks in advance.
    Vithalprasad

    Hi All,
    Thanks a lot for your response.
    All these FMs are using timestamp which is having length of 14 or 16. .But in this case the field ARFCSDATA-ARFCTIME is having values in char 8 field and these values are in hexa decimal format.
    Please pass the information in this regard if you have.
    Thanks a lot.
    Vithalprasad

  • Help to read a table with data source and convert time stamp

    Hi Gurus,
      I have a req and need to write a ABAP prog. As soon as i excute ABAP program it should ask me enter a data source name, then my ABAP prog has excute teh code, in ABAP code i have to read a table with this data source as key, sort time stamp from table and should display the data source and time stamp as output.
    As follows:
    Enter Data Source Name: 
    Then user enters : 2lis_11_vahdr
    Then out put should be "Data source  :"  10-15-2008.
    The time stamp format in table is 20,050,126,031,520 (YYYYMMDDhhmmss). I have to display as 05-26-2005. Any help would be apprciated.
    Thanks,
    Ram

    Hi Jayanthi Babu Peruri,
    I tried to extract YEAR, MONTH, DAY separately and using
    EDIT MASK written it.
    Definitely there will be some STANDARD CONVERSION ROUTINE will be there. But no idea about it.
    DATA : V_TS      TYPE TIMESTAMP,
           V_TS_T    TYPE CHAR16,
           V_YYYY    TYPE CHAR04,
           V_MM      TYPE CHAR02,
           V_DD      TYPE CHAR02.
    START-OF-SELECTION.
      GET TIME STAMP FIELD V_TS.
      V_TS_T = V_TS.
      CONDENSE V_TS_T.
      V_YYYY = V_TS_T.
      V_MM   = V_TS_T+4(2).
      V_DD   = V_TS_T+6(2).
      V_TS_T(2) = V_MM.
      V_TS_T+2(2) = V_DD.
      V_TS_T+4(4) = V_YYYY.
      SKIP 10.
      WRITE : /10 V_TS," USING EDIT MASK '____-__-________'.
              /10 V_YYYY,
              /10 V_MM,
              /10 V_DD,
              /10 V_TS_T USING EDIT MASK '__-__-__________'.
    If you want DATE alone, just declare the length of V_TS_T as 10.
    Regards,
    R.Nagarajan.
    We can -

  • Time stamp conversion and graphs from array data

    How can you read time stamps and data currently in an text file as an array and split in for display on a graph. I think I need to convert the time stamp back into seconds to do this but not sure how to do so?

    If you're using 8.2, the Read From Spreadsheet File VI can read string files. If not, you will need to open the VI and read the instruction on the diagram for how to change it.
    Once you have your string array, you can use the VI found here to convert the time column (note - read the thread) and convert the second column using the String to Number functions.
    Try to take over the world!

Maybe you are looking for

  • I cannot download a working version of Firefox at all. Downloads seem normal but No Program in "Add or Delete programs"and NO ICON

    I kept getting a mssg "update did not download. make sure there are no other copys of Firefox on your computer". That was on the user account I use strictly for the internet. I keep 3 user accounts, One is the administrator for security, a sort of 3

  • Open portal from a link in Word

    Hello, I currently have a strange issue. First the scenario: I have a SP17 portal, inside the portal I have an ITS (6.20) iView running an EWT. Inside this EWT I have the option to click a button which opens a Word document in a new Window. Inside th

  • Events are not deleted from EventHub

    Hello, I'm using an Event Hub. I've set the Message Retention to 1 day, however I still have events from more than a week ago. How do I delete old events from my event hub? Thanks, Janiv, Janiv Ratson. Technology and Development Expert. | BL: http://

  • Text_IO.Fopen

    Hello, I would like to ask, in which directory, does text_io.fopen searches to find the file for opening? for example if I say in a fmb/pll file in a program unit, in_file := Text_IO.Fopen(salary.txt, 'r'); without specifing the whole directory path

  • Illustrator CS6 speichern als .svg

    Hallo zusammen, ich bearbeite Bilder welche in Anleitungen einfließen. Dazu habe ich in Illustrator eine Vorlage (Breite, Höhe, Positionsnummern, etc.) erstellt. Diese Vorlage verwende ich für alle Bilder. Es wird dann auf der untersten Ebene eine ti