iOS Question Get the tick value of a date string

Discussion in 'iOS Questions' started by ciginfo, Mar 26, 2015.

  1. ciginfo

    ciginfo Active Member Licensed User

    Is this code right? I want to obtain the tick value of a date "Thedate" registered in a database as date (AAAA-MM-JJ). It seems it does not work.
    What is the the syntax of "DateTime.DateTimeParse(Mydate,"")" if I want only date and not time. (I have not time in the database)

    Code:
    Dim  Mydate, Newdate, As Long
    Mydate = M.Get(
    "Thedate")
    DateTime.DateFormat="AAAA-MM-JJ"
    DateTime.TimeFormat="H:mma"
    Newdate = 
    DateTime.DateTimeParse(Mydate,"")
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. ciginfo

    ciginfo Active Member Licensed User

  4. Erel

    Erel Administrator Staff Member Licensed User

    DateParse is a B4i method. It will not appear in Oracle documentation. I posted the link so you can read more about the date format patterns.

    What is the problem with the code you posted?
     
  5. ciginfo

    ciginfo Active Member Licensed User

    Error parsing: 2015
    See on attached image
     

    Attached Files:

  6. klaus

    klaus Expert Licensed User

    In your code you define DateDebut as a Long.
    Then you use TheDateDebut = DateTime.DateParse(DateDebut).
    But DateTime.DateParse(DateDebut) expects a String and not a Long.
    Put a breakpoint in line 204 and look at DateDebut.
     
  7. ciginfo

    ciginfo Active Member Licensed User

    In fact, DateDebut is in my database phpmyadmin as a date (yyyy-MM-dd). There is not variable as date in B4i and i don't know if i have to consider DateDebut as a long or as a string. It seems i have to consider as a string.
     
  8. klaus

    klaus Expert Licensed User

    As your date is in yyyy-MM-dd format you must consider it as a string.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice