Problem converting U8 array to date-time string

Hi All,
How can I convert U8 array (time_t data type from C dll) to date time string?
A dll function that I am calling has a structure of string, integer and time_t as one of the parameters. Instead of passing cluster, I pass an array of U8 of the size that the structure should be. All the members of the strcuture and parsed correctly except the date/time.
Function Parameter:
typedef struct {
Int AlarmState ;
Int AlarmGrade ;
TCHAR AlarmMessage [100] ;
time_t AlarmTimeStamp ;
} WV_ALARM_INFO ;
Total size = 4 + 4 + 100 + 4 = 112
Using Call Library Function, I set the parameter type to Array of U8 and size 112.
After the array is populated when the function is called, I have done the following to interpret date and time.
1) Using Extract Zero Terminated String.VI I converted U8 array (of size 4) to string.
2) Type casted string to integer (I32).
3) Swap bytes
4) Swap Words
5) Format Date/Time String.
Please see the attached screenshot for visual display of the above.
Ideas on why the year is incorrect?
Mimansa
Attachments:
Time.JPG ‏102 KB

Hi Mimansa,
Is it only the year that is incorrect? Also, where did you find that ABC\0 VI that you use 3 times? Did you make it or is it in a labview library somewhere?
Thanks,
Laura

Similar Messages

  • When I run this VI "Waveform Time to Date Time String" in LabView 7.0 it will not pass decimals of seconds.

    When I run this VI "Waveform Time to Date Time String" in LabView 7.0 it will not pass decimals of seconds. From decimals of inputline. If i disconnect the input to the subVI "Get Date/Time string vi" it will work propperly, it also doses if I reconnect it. I use LabViev 7.0.
    So the problem i solved, but i dosent understund why it works in this way. Does it indicate other problems which will make my researchprogram unrelaible ?
    Attachments:
    Waveform_Time_to_Date_Time_String.vi ‏18 KB

    Hello.
    I checked your vi and it fails as you state.
    It runs fine if: 1 Convert number to timestamp OR
    2 Wire a constant to want seconds?
    In labview 7.1, no problems.
    I think is a job for NI engeniers.
    Hope it helps
    Alipio
    "Qod natura non dat, Salmantica non praestat"

  • Increment the number with date/time string. when ever the next date come's it should reset again with initial number

     i want to store the number of records in a file. Every time when ever i run the program the record will be incremented well i using forloop with count value 1 as a constant .in the for loop i am using autoincrement with the  feedback node . to view the number i have attached the indicatator .the number will be increment every time . i am using number to time time stamp  that is connected to get date/time string. from that we can view the date string and time string . so , my issue is when ever i close the code again it is coming with intial value . i should get from that number only where ever i close the code . after the date completed again it should come from intial value . i am attaching the code so that u guys can solve my problem.
    Attachments:
    record.doc ‏34 KB

    here you can see.......the file path in case structure in that i have included my requirement of increment the number 
    -> if the case is true then it goes in ok file path and the no of records string will pass in the file by seeing these code u will get the clarity
    my requirement is the number of records should increase ........ whnever the program runs...that i made it. by the next day again it should begain with the intial value.........that is my requirement. i hope u understand .
    suggest me how can i use the  intial  value .......
    Attachments:
    code.vi ‏35 KB

  • How to compare Date/time string

    I read from datalog file including Date/time string ,and want to query the special Date/time string span ,how to compare the data/time string ?

    Hello Joshua,
    To compare date/time you have to extract the different components (day, month, year, hour, minute, second) anyway. Why not "convert to seconds"? I think it's easier to compare one number (where you also can do other math, like calc the difference and so on) than to compare seven (?) parameters with some exceptions... If the dates are read from excel (there was a similar thread some days ago), why not convert to seconds in excel (just a format change)?
    Best regards,
    GerdW
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Date time string from UME-SPML interface

    Hi,
    I am using the UME-SPML interface to manage users in SAP UME and using AS ABAP user management as the user store for UME.
    I have noticed a problem in the date time string returned in the SPML search response when I search for a user. When you search for a user, normally you get 3 date time strings for "validfrom", "validto" and "lastmodifydate".
    These are what have been returned in the SPML response:
    <attr name="lastmodifydate"><value>20101019030648Z</value></attr>
    <attr name="validfrom"><value>20101019010000Z</value></attr>
    <attr name="validto"><value>25001230010000Z</value></attr>
    When I check the same user with the user management administration console, I get these:
    Date of Account Creation: Oct 19, 2010 2:06:48 PM (Eastern Standard Time (New South Wales))
    Start Date of Account Validity: Oct 20, 2010 12:00:00 AM (Eastern Standard Time (New South Wales))
    End Date of Account Validity: Dec 31, 2500 12:00:00 AM (Eastern Standard Time (New South Wales))
    The timezone I am in is GMT10 (Australia Eastern Standard Time (New South Wales)) and now we in day light saving so effectively we are in GMT11 now.
    You can see that the datetime string for "lastmodifydate" correctly reflects what's shown on user management administration console.
    But the datetime strings for "validfrom" and "validto" seems to get the conversion wrong: both seem to be using 12 hour format instead of 24 hour format. (2010 10 19 01 00 00Z should be 2010 10 19 13 00 00Z and 2500 12 30 01 00 00Z should be 2500 12 30 13 00 00Z)(I have put in a space in the string to break up the date time components)
    Anyone has any idea what went wrong here?
    Regards,
    GG

    Also search service.sap.com for the term "sy-zonlo".
    Personally I am a member of the [flat earth society|http://en.wikipedia.org/wiki/Flat_Earth_Society] when it get to this topic, because it causes no end of problems.
    Most customers simply stop operations on 31.12.xxxx or before, or alternately use reporting tools to make corrections afterwards.
    In the security realm, SAP also respects server side timestamp tolerances (only a few seconds are allowed).
    Time is server time in my books. Some people work late, others early - and there is nothing you can control to stop a customer in the US from placing an order via a system in Japan anyway.
    Anyway, this is probably a program error with the 12 hour format in the component software or possibly the API interface to user management in your release so you should open a customer message with SAP (my best guess).
    Cheers,
    Julius

  • Week returned by Format Date/time String

    Has anyone tested the Format Date/Time String function with the week formating codes?
    I want to create a subfolder for each week and name the folder accordingly. For 17 December 2003 the week is 51 in the year 03 but I get week 50. For 29 December 2003 the week is 01 in the year 04 but I get week 52. For 01 January 2004 the week is 01 in the year 04 but I get week 00. For 29 December 2004 the week is 53 in the year 04 but I get week 52. For 01 January 2005 the week is 53 in the year 04 but I get week 00. There is no difference using %U or %W as code (this will be if 1 January will fall on Sunday or Monday which it does not in my examples).
    I know normally a year has weeks 1 to 52 but in some years the last week may have week
    53 as in 2004. Adding 1 to the week does not solve the problem. For 29 December 2003 it would give 53. And 53 maybe a correct week as in 2004. For 1 January 2005 it would give 1 but the week is the week in the year before.
    All the week numbering I expect is correct for Germany but the function is not. Is the numbering from the function correct for your country?
    Please reply where you are located and if the function will work right for you.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

    I have found two resources about date and time and their formats.
    One is the ISO Standard 8601, the second is a german page. On this page along with other information all definitions used by Windows is listed.
    According to this page the ISO Standard has been established in Europe and most industrial countries. In USA it is ANSI X3.30-1985(R1991) and NIST FIPS 4-1.
    Since the ANSI definition you mentioned allows only Sunday (Jewish) or Monday (Christian) as first day of the week it ignores the Islamic world. For them the first day is Saturday. I could not gather information about Buddhistic or Hinduism
    based countries.
    For my application and the market aimed the ISO format is the one which will be choosen. Using %W and handling of week 0 should do it.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • Day of year bug - format date/time string and scan from string?

    I've noticed that the day of year returned by "Format Date/Time String.vi" starts with a value of 1 for Jan-1 while "Scan from String.vi" wants a 0 index.  Is this a bug or feature?  
    (I'm using Labview 2010 Service Pack 1)

    I think the best idea is to use seconds since for your arithmetic, because it is going to be the most consistent and robust solution. Knowing that a day has 86400 seconds is all that is needed and you won't run in possible inconsistencies with date time implementations caused by our anything but logic calender. I would hazard that the functionality of converting a timestamp into year and day of year and back is impossible to make consistent without sacrificing other possibly conflicting transformation in the Timestamp into String and Timestamp from String manipulations.
    "Seconds since" being the actual base unit in all LabVIEW timestamps, it is best to do any arithmetic on it in this base unit.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Convert Data type from Oracle Data time string to SQL Date time data type

    I have a time stamp column pulled from oracle into a SQL server db table varchar datatype column.
    Now i want to change that column to date time.
    Following is the data present in the table:
    01-APR-11 02.15.00.026000 AM -08:00
    01-APR-11 04.15.00.399000 AM -08:00
    01-APR-11 06.15.00.039000 AM -08:00
    I want to convert this data into sql server datetime data type.
    Please advice.
    Thanks,
    Sam.
    I am unable to find the solution in other sites which is why I have posted it in Oracle forum for seeking solution.
    Thanks in Advance.
    Sam.

    Sam,
    How are you actually loading the data into SQL*Server - are you using something like an Oracle gateway, BCP or another Microsoft utility of some sort ?
    If you are using an Oracle problem then we may be able to help but if using a Microsoft utility then you should really follow up with Microsoft to know what format the data should be in to use a Microsoft utility.
    Regards,
    Mike

  • GregorianCalendar datetime format convert to  sql server date time format

    please help me
    my GregorianCalendar date time format is like this. *08/01/29 02:25:59* . I try to insert my database(sql server 2000 )
    data type is datetime ,in my database table display like this *2029-08-01 02:25:59.000* .can you help me to insert correct date in my database table like ( . *08/01/29 02:25:59*)

    use [PreparedStatement |http://java.sun.com/javase/6/docs/api/java/sql/PreparedStatement.html] and setTimestamp:
    [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html]

  • Converting date time string to double data

    I have to plot a bar chart. The VI accepts only 2-d double data. My X- axis is date timestamp and Y- axis is the double data.
    Bt I am unable to convert the timestamp value to double.
    Anyone can suggest anything ?
    Regards,
    Runjhun.

    Thnx a lot Darin.
    Bt may be I should be more clear with my reqmts.
    In the image attached the data to be plotted is stored in Excel from LabVIEW.
    And the graph is plotted in Excel selecting the data.
    Plotting of graph is maual.
    I want that the graph plotting should be automatic.
    In RGT der's a function Excel Plot Graph bt the problem is dat it takes only 2d double array as I mentioned earlier.
    May be dis wil make my problem clearer.
    Regards,
    Runjhun A.
    Attachments:
    plot_type.jpg ‏3724 KB

  • Date Problem-adding 30days to the date in string format.

    hi i have an Date in the form of String "yyyy-mm-dd",i have to add 30 days to that date and compare it with to days date,i try to convert the string in to date format using SimpleDateFormat,but i could not understand how to add 30 days to that.pl it's an urgent problem,any help would be appreciated.
    Regards.

    to compare the date to todays date,
    Calendar todaysDate = Calendar.getInstance();
    todaysDate.after(cal2);
    todaysDate.before(cal2);
    Depending on which way you want to know.
    To get the String Format I would suggest something like :
    String dateInString = "" + cal2.get(Calendar.YEAR) + "-" + cal2.get(Calendar.MONTH) + "-" + cal2.get(Calendar.DATE);
    Be careful though as this may give a format YYYY-M-D if the month or date is a single digit, so you may have to test string.length and then have "0"+cal2.get(Calendar.MONTH) /cal2.get(Calendar.DATE)
    Hope this is of some help.

  • How to convert a timestamp to date/time in CDS View?

    Dear experts,
    I would like to convert a timestamp to a date and time within a CDS view.
    This is what I tried to do:
    Cast (Cast(<timestamp> as abap.dec(8,0)) as abap.dats) as <date>
    I also thought about first converting the timestamp into a plain numerical character, then using substring and then casting it to abap.dats. Then its giving me an error that says: "dec can't be converted into numc".
    The above written code also throws an error - "function not allowed/ no cast within a cast".
    It is quite nasty not being able to write a cast within a cast - how else am i supposed to achieve a date here?
    I am looking forward to have your answers!
    Thanks and BR
    Anja

    Hi Anja,
    what you try to do is currently not possible, a feature not available in CDS views.
    Yet it surely is a feature, ABAP developers would like to see on the feature request list .
    Cheers,
      Jasmin

  • How to convert an array of Integers into String

    So how can an array of integers be converted into a string?
    As I do not have a javac with me now, I hope you guys could help.
    Can it be done this way:
    int [] value = new int[] {2,3,4,5,6,7}
    String strValue = "";
    for (i=0; i<value.length-1; i++)
    strValue += value;

    Instead of working with Strings, I would suggest you use a StringBuffer. It will improve memory utilization.
    Like this:
    int [] values = new int[] {2,3,4,5,6,7};
    StringBuffer sbTmp = new StringBuffer();
    final int size = values.length;
    for (i = 0; i < size; i++) {
    String intStr = Integer.toString(values);
    sbTmp.append(intStr);
    String strValues = sbTmp.toString();

  • Converting float fields to date Time

    I have an application that stores datetimes into float fields, the data is formatted yyyymmddhhmmss or 20081122091030. I need to convert this data to a datetime data type so I can do datetime calculations (differences) for reporting purposes. It would be preferable to have the data formatted yyyy/mm/dd hh:mms. I have tried numerous methods with out success. As I understand it I need to CONVERT to a VARCHAR first.  I am new to TSQL & this one turning out to be a knotty problem so I would really appreciate anyone’s assistance,
    SELECT (
      LEFT(CAST(IS_DUE_DATE AS VARCHAR(14)),8) + ' ' +
        SUBSTRING(CAST(IS_DUE_DATE AS VARCHAR(14)),9,2) + ':' +
        SUBSTRING(CAST(IS_DUE_DATE AS VARCHAR(14)),11,2) + ':' +
        SUBSTRING(CAST(IS_DUE_DATE AS VARCHAR(14)),13,2))
    FROM  ISSUES
    However when I try to Covert to DATETIME it all goes pear shaped.

    Try this
    Code Snippet
    DECLARE @MyDate float
    SET @MyDate = 20090922112143997
    SELECT CONVERT(DATETIME,
    LEFT(CAST(CAST(@MyDate as BigInt) as varchar(20)),8)+' '+
    SUBSTRING(CAST(CAST(@MyDate as BigInt) as varchar(20)),9,2)+':'+
    SUBSTRING(CAST(CAST(@MyDate as BigInt) as varchar(20)),11,2)+':'+
    SUBSTRING(CAST(CAST(@MyDate as BigInt) as varchar(20)),13,2) + '.' +
    SUBSTRING(CAST(CAST(@MyDate as BigInt) as varchar(20)),15,3)
    Added using a temp table:
    Code Snippet
    CREATE TABLE #T
    fdate float
    go
    INSERT INTO #T VALUES (20090922112143997)
    INSERT INTO #T VALUES (20090921182143997)
    INSERT INTO #T VALUES (20090921012323997)
    SELECT CONVERT(DATETIME,
    LEFT(CAST(CAST(fdate as BigInt) as varchar(20)),8)+' '+
    SUBSTRING(CAST(CAST(fdate as BigInt) as varchar(20)),9,2)+':'+
    SUBSTRING(CAST(CAST(fdate as BigInt) as varchar(20)),11,2)+':'+
    SUBSTRING(CAST(CAST(fdate as BigInt) as varchar(20)),13,2) + '.' +
    SUBSTRING(CAST(CAST(fdate as BigInt) as varchar(20)),15,3)
    FROM #T
    DROP TABLE #T

  • Time String to Timestamp Conversion Problem

    Hi,
    I attempted to convert time string to timestamp but I failed. What is the wrong with it? I need a timestamp to create waveforms.
    Egemen
    Solved!
    Go to Solution.
    Attachments:
    Time String to Timestamp.png ‏18 KB

    You are right Gogineni, when I got the error, I was using %S in the format string for Format Date/Time String function and %3u in the format string for Scan From String.
    I found the solution in this thread - use %S%3u in both places.
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.

Maybe you are looking for

  • X230 with windows 7 still won't connect to any bluetooth devices after many attempted solutions

    My starting point: I have 6 month old x230 with windows 7, all windows and lenovo updates already completed.  The bluetooth logo exists on the bottom of screen but when I try to "add device" it doesn't recognize any bluetooth devices.  I've tried thi

  • What is the best way to create a DVD onsite?

    I have a challenge that I hope someone can help me with. I work with a company that shoots video of dance competitions.  The routines are typically 2.5 minutes long and are recorded to tape.  I would like to be able to capture the video, possibly fro

  • JSP page not rendering in IE

    Hi, Here is a JSP page I'm working on for school: http://lectura.cs.arizona.edu:23456/main.jsp?section=login It renders fine in Mozilla, but I get a white page in IE. If you "view source" in IE, the code is there, and I have no idea why. I tried crea

  • SNMP Get-reques​ts and how to disable...​..Urgent!

    We still have a bunch of ISDN sites that literally charge us by the minute.    We have some HP 4100 printers at these sights (we'll call it site A) and there queues are located (across a VLAN) at another site (site b).   The problem we are gaving is

  • BI version to install for new implementation

    Hello, I am a technical consultant for a new implementation of BW with the requirement of SEM-BPS. We are considering installing NW2004s with BI Content 7.0. However since it is so new we are wondering about the stability. We are also not sure if we