LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  timestamp: string to integer

    Employee
    Posted 11-21-2013 07:26

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: amacdoug

    Hi,

    I've searched the forums/threads but can't find anything that quite works. I'm new to Lavastorm so bear with me!

    The data I'm using has a time stamp in the following format: 2013-10-10 17:47:18.24. It's string, and I need to be able to convert it to an integer because the analysis I'm doing is to compare the time between time stamps.

    Any ideas? Suggestions in other forums (like splitting the date and time and then running "date" and "time" functions on them and then joining them back up don't seem to work).

    Any guidance is appreciated. Thanks!


  • 2.  RE: timestamp: string to integer

    Employee
    Posted 11-21-2013 08:57

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    This should work:

    d1=datetime(date(field1.left(10),"CCYY-MM-DD"),time(field1.right(11).left(8),"HH:MM:SS"))
    d2=datetime(date(field2.left(10),"CCYY-MM-DD"),time(field2.right(11).left(8),"HH:MM:SS"))
    delta = d2 - d1