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

Similar Messages

  • 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

  • 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

  • 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

  • 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

  • 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"

  • I need FM calc. days/months/years between 2 dates but computes the work day

    I need FM calc. days/months/years between 2 dates but computes the work day.
    someone knows ?

    Hi,
    The FM is 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
    Check the following example:
    DATA: EDAYS   LIKE VTBBEWE-ATAGE,
          EMONTHS LIKE VTBBEWE-ATAGE,
          EYEARS  LIKE VTBBEWE-ATAGE.
    PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
                TODATE   LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
    call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
      exporting
        i_date_from          = FROMDATE
        i_date_to            = TODATE
      I_FLG_SEPARATE       = ' '
      IMPORTING
        E_DAYS               = EDAYS
        E_MONTHS             = EMONTHS
        E_YEARS              = EYEARS.
    WRITE:/ 'Difference in Days   ', EDAYS.
    WRITE:/ 'Difference in Months ', EMONTHS.
    WRITE:/ 'Difference in Years  ', EYEARS.
    INITIALIZATION.
    FROMDATE = SY-DATUM - 60.
    Regards,
    Bhaskar

  • Extract date/time stamp and modifier name from memo field

    I need to extract all date/time stamps and modifier name strings from the Work Log memo field - or conversely, filter out all of the comments after the date/time modifier strings.    I have the string extract but it only extracts the first one.  I need to loop until all are found - how can I do this?  The memo field will look something like this:
    3/5/2009 3:32:05 PM John Doe
    Comments - string can be any length
    3/4/2009 12:35:43 PM John Doe
    Comments - string can be any length
    3/4/2009 12:28:17 PM Jane Dough
    Comments - string can be any length and include date format 2009-06-04 14:20 CST.
    3/4/2009 12:27:47 PM Mary HadaliddleLam
    Comments - string can be any length
    3/4/2009 12:26:55 PM Lamseedivy
    Comments - string can be any length
    3/4/2009 12:15:22 PM Mareseedoes
    Comments - string can be any length.

    Here is a formula that will strip all 'comment' and blank lines and puts the datetime stamp and user names into an array.  You have to manipulate the elements of the array to further separate the datetime stamp and user name if required.
    // Declare two indices
    numbervar i := 1;
    numbervar j := 1;
    // Split each row of the memo field into an array
    // if chr(10) does not work then try with chrw(13) or chr(13)
    stringvar array x := split({Sheet1_.Comments},chr(10));
    // Declare a holding array
    stringvar array y;
    // Declare the size of the new array to be equal to the elements in array 1
    redim y[ubound(x)];
    // Copy only if the first word of each element of array 1 is neither "comments" nor a blank line
    for i := 1 to ubound(x) do
    if split(x<i>) = 'comments' or x<i> = '' then
    else
    (y[j] := x<i>;
    j := j + 1;
    // Compress the new array to eliminate the last blank element
    redim preserve y[j-1];
    // Joining the elements of the new array and the number of elements for display
    join(y,chrw(13)) & chrw(13) & ubound(y);
    With your example, this formula will return:
    3/5/2009 3:32:05 PM John Doe
    3/4/2009 12:35:43 PM John Doe
    3/4/2009 12:28:17 PM Jane Dough
    3/4/2009 12:27:47 PM Mary HadaliddleLam
    3/4/2009 12:26:55 PM Lamseedivy
    3/4/2009 12:15:22 PM Mareseedoes
    6.00
    Make sure the "can grow" option is checked to display the results and also check for case sensitivity of "comments".
    Edited by: Sanjay Kodidine on Jun 30, 2009 10:13 AM

  • Hi icant sync my photos from itunes to iphone ..it shows copying 1 out of something but afterwards it stops and no photos in iphone ..i formatted several times ..and from my utunes i have sync my brothers iphone it synced prefectly only its problm of my p

    hi icant sync my photos from itunes to iphone ..it shows copying 1 out of something but afterwards it stops and no photos in iphone ..i formatted several times ..and from my utunes i have sync my brothers iphone it synced prefectly only its problm of my iphone .......i have also deleted the ipod photo cache but still the same

    can any 1 help me

  • GREP: date/time search and replace

    Hi everybody,
    I frequently import XML files to InDesign. The XML structure always contains the following information among others:
    start date
    start time
    end date
    end time
    For example, it looks like this:
    21.08.2013
    09:00
    25.08.2013
    18:00
    Now I need to re-arrange these fields in one row, just like this:
    21.08.2013, 09:00 - 25.08.2013, 18:00
    I already found out how to do this via GREP, but I need to go one step further:
    If "start date" and "end date" are the same (for example both are "21.08.2013"), I would like to skip the "end date" in the output. It should look like this:
    21.08.2013, 09:00 - 18:00
    Is there a way to do this via GREP?
    Thanks in advance!

    This will do it
    Trevor
    // By Trevor http://forums.adobe.com/thread/1261365?tstart=0
    app.doScript("formatDates ()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "GREP: date/time search and replace");
    function formatDates ()
            app.findGrepPreferences = app.changeGrepPreferences = null;
            app.findGrepPreferences.findWhat = "\\d\\d\.\\d\\d\.\\d\\d\\d\\d\r\\d\\d:\\d\\d\r\\d\\d\.\\d\\d\.\\d\\d\\d\\d\r(?=\\d\\d:\\d\\d\r)";
            var doc = app.activeDocument,
                  dateFinds = doc.findGrep(),
                  l = dateFinds.length, dates;
            while (l--)
                    app.findGrepPreferences.findWhat = "(\\d\\d\.\\d\\d\.\\d\\d\\d\\d)";
                    dates = dateFinds[l].findGrep();
                    app.findGrepPreferences.findWhat = "(\\d\\d\.\\d\\d\.\\d\\d\\d\\d)\r(\\d\\d:\\d\\d)\r(\\d\\d\.\\d\\d\.\\d\\d\\d\\d)\r";
                    if (dates[0].contents == dates[1].contents) app.changeGrepPreferences.changeTo = "$1 $2 - ";
                    else app.changeGrepPreferences.changeTo = "$1 $2 - $3 ";
                    dateFinds[l].changeGrep();

  • 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

  • How to return a specific date/time range and last event details, when checking the event log via command prompt

    I am new to scripting (literally started reading/learning scripting a few hours ago), and I am stuck in trying to get my current script/command to filter a specific date range.
    * Note: I am working with Server 2003 and 2008; because of the environment I am in, a lot of scripts (such as Powershell and VBScript) don't work; trying to stick with command line, as it appears to be the only thing that functions correctly in my environment
    I am trying to search the System log in event viewer, for the most recent server reboot. Here is the command that I am currently running:
    ===========================================================
    C:\Windows\System32\cscript C:\Windows\System32\eventquery.vbs /L System /FI "id eq 1074"
    ===========================================================
    When run, the output looks like this:
    ===========================================================
    Microsoft (R) Windows Script Host Version 5.6
    Copyright (C) Microsoft Corporation 1996-2001. All rights reserved
    Listing the events in 'system' log of host 'xxxxxxxxxxxxxxx'
    Type Event
    Date Time    Source
    Information 1074
    12/18/2013 2:48:06 AM    USER32
    Information 1074
    11/20/2013 3:25:04 AM    USER32
    Information 1074
    10/23/2013 2:06:09 AM    USER32
    ===========================================================
    What I would like it to do is only show events that have happened in the last seven days, as well as show the event details if it does find an event that matches the criteria.
    Any help would be greatly appreciated. Thanks!
    Nick

    I would prefer using Powershell , you can use below code 
    function Get-EventViewer
    param(
    [string[]]$ComputerName = $ENV:COMPUTERNAME,[string]$LogName,[int]$eventid
    $Object =@()
    foreach ($Computer in $ComputerName)
    $ApplicationEvents = get-eventlog -logname $LogName -cn $computer -after (Get-Date).AddDays(-7) | ?{$_.eventid -eq "$eventid" }
    foreach ($event in $ApplicationEvents) {
    $Object += New-Object -Type PSObject -Property @{
    ComputerName = $Computer.ToUpper();
    TimeGenerated = $event.TimeGenerated;
    EntryType = $event.EntryType;
    Source = $event.Source;
    Message = $event.Message;
    $column1 = @{expression="ComputerName"; width=12; label="ComputerName"; alignment="left"}
    $column2 = @{expression="TimeGenerated"; width=22; label="TimeGenerated"; alignment="left"}
    $column3 = @{expression="EntryType"; width=10; label="EntryType"; alignment="left"}
    $column4 = @{expression="Source"; width=15; label="Source"; alignment="left"}
    $column5 = @{expression="Message"; width=100; label="Message"; alignment="left"}
    $Object|format-table $column1, $column2, $column3 ,$column4 ,$column5
    $Object.GetEnumerator() | Out-GridView -Title "Event Viewer"
    You can do a function call like
    Get-EventViewer -LogName system -ComputerName "computername" -eventid "2017"

  • Date/Time, EXIF and Lightroom

    I am quite aware of the past thread on the date/time issue started by Judy
    Nicholls. But id did not help me to solve a mystery I am experiencing with a
    bunch of jpegs made shot some years back.
    Lightroom states that these files have no date - none is shown in the metadata
    panel to the right, and they are selected in the metadata browser when selecting
    "unknown date".
    But several EXIF reader programs, including EXIFUtil, EXIFEditor and EXIF Pilot
    clearly show me that the three relevant EXIF dates are there, are correct and
    are identical. The EXIF header, the whole metadata section, seems to be complete
    and readable outside LR. Oddly, EXIFER shows a date of "3--DEC-99" for Date
    Taken in its file listing, but then shows the three relevant date entries
    correctly and identically when doing an EXIF edit.
    Why can't LR read these dates?
    As a test, I tried to add the capture date through the menu (Metadata - Edit
    Capture time ...), and it LR reacted to the added date by putting the file among
    those with a known date (2003). But it did not change the EXIF data in the file,
    apparently only a date in the LR database. I exported XMP to the file, read the
    resulting data with EXIFUtil - but could not find any difference with the
    original file!
    Can anybody explain what is going on here?
    Chris

    Ok, here's what I've found:
    If the "xmp" sidecar exists and you do "Read metadata from file", it will read the metadata from the "xmp" sidecar. If the "xmp" sidecar doesn't exist, then if you "Read metadata from file" it reads it from the image itself.
    Thus, if you have an "xmp" sidecar file that exists and use an EXIF editor on the original image, the EXIF time change will *never* be imported again from the image file no matter how hard you try (ie: it will be ignored). If you remove the "xmp" sidecar, then you can get it to read the EXIF time data from the image. I don't think you have to "reimport" as some have done, but rather just delete the "xmp" sidecar.
    However, and this is important, if you've already made Develop edits, those edits will be lost on the "Read metadata from file", import of EXIF data from the image.
    If you think you'll be tricky and move out the "xmp" sidecar, edit the EXIF time data in the original image, import the metadata from the image, move back the "xmp" sidecar, and re-import the metadata and you'll get the best of both worlds, well no, you're SOL. The "xmp" sidecar date/time overrides the EXIF date/time previously imported.
    So, I'll probably be stuck exporting my RAWs, then fixing the EXIF time data after the fact in the JPEGs since I've already made tons of edits across my 1,000+ photos for this batch.
    Incidentally, iMatch by Photools can do a batched EXIF time correction by partial or full hour offset (or day) and Lightroom seems to be happy with the EXIF date format. iMatch is a pretty nice tool in of itself and probably better for general photo organization at least in the iteration of Lightroom (it is not a RAW converter though).
    It can also do edits of XMP data, including with Visual Basic like scripted edits, so perhaps I can eak it out to do the fix that way (or re-export the fixed EXIF data into the XMP data without touching the rest of the Develop edit data also there).
    Yuck!
    Lightroom is a very nice app, but it's certainly still pretty "beta" in many respects.

  • Function Modules for Format Date, Month Name and Quarter value.

    Hi All,
    1. I am getting the date field from the Flatfile, so i need to format the date to YYYYMMDD. Is there any Function module for that in BW.
    2. Based on the above Formated Date i have to find out the Name of the Month like JANUARY, FEBUARY etc.
    3. Based on the same above Formated Date i need to find out the Quarter like 1, 2 etc.
    Could you please let me know if any function modules are there for the above questions in BW not in ABAP, why i mention is some Function modules are there in ABAP but not in BW.
    Thanks in advance.
    Regards,
    srinivas

    Hi ,
    1.If your input date format is MMDDYYYY then Use SDATE as conversion routine in trans strucutre to convert into YYYYMMDD.
    2.By passing year as input parameter for the following FM you would get all the months with text.Using READ statement in routine you can get month name
    MONTH_NAMES_GET
    3.For Quarters you can use the following FM:
    TSTR_PERIODS_QUARTERS
    hope it helps...
    regards,
    Raju

Maybe you are looking for