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.  Convert Date to seconds and Seconds to date

    Employee
    Posted 03-16-2011 07:50

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

    Originally posted by: zon



    Hi,
    Can some one help me how to convert, for example:
    16/03/2011 14:41:32, to seconds
    and convert seconds to date. How can I do that with MDA.

    Best Regards,

    ZON


  • 2.  RE: Convert Date to seconds and Seconds to date

    Employee
    Posted 03-16-2011 08:10

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

    Originally posted by: stonysmith

    You can use the TimeStamp function:

    timestring="16/03/2011 14:41:32"
    stamp=timestamp(date(timestring.left(10),"DD/MM/CCYY"),time(timestring.right(8),"HH:MM:SS"))

    emit stamp.date()


  • 3.  RE: Convert Date to seconds and Seconds to date

    Employee
    Posted 03-16-2011 11:28

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

    Originally posted by: zon

    Hi,

    Thanks for your fast answer, but I didn't understood.
    What I need is:
    16-03-2011 18:15:30 ... <converts to> ...
    2011 - 31536000 sec
    03 - 7776000 sec
    16 - 1382400 sec
    18 - 64800 sec
    15 - 900 sec
    30 - 30 sec
    Total - 40760130 sec (this is it).

    And then do the other way around. Convert the 40760130 sec into 16-03-2011 18:15:30.
    Basically I need this to determine the end time of a call. I convert the start time to seconds, add the duration of the call in seconds, and then convert it to the end date.

    Best Regards,
    ZON


  • 4.  RE: Convert Date to seconds and Seconds to date

    Employee
    Posted 03-16-2011 12:17

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

    Originally posted by: stonysmith

    You don't need to go to that much work...

    use my original code:
    timestring="16/03/2011 14:41:32"
    stamp_start=timestamp(date(timestring.left(10),"DD/MM/CCYY"),time(timestring.right(8),"HH:MM:SS"))

    then use this:
    stamp_end=dateTimeAdjust(stamp_start,30,"seconds")


    ... internally, a datetime value is already computed/stored in seconds since 1/1/1970


  • 5.  RE: Convert Date to seconds and Seconds to date

    Employee
    Posted 03-17-2011 03:38

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

    Originally posted by: zon

    Thanks You!

    I was having so much trouble with calculations and, after all, is so easy!
    That's just spectacular! Problem solved!

    Best Regards,
    ZON