Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Best Practices: Date conversion 10 Sep 2021 14:40 #19548

  • OhioJoe
  • OhioJoe's Avatar
  • Topic Author


  • Posts: 90
  • Moving from DBF to SQL. When I did this before (to SQLite) I converted the DBF dates to strings:
    09/10/2021 becomes "20210910"
    The table column was an 8-space Char type. Easy to convert and fairly easy to adjust the programming logic throughout the app.
    My question is:
    Is this the way to do it going forward, or should I use another approach?
    Trying to use a common date format that works across all SQL database types.
    Thanks everyone.
    Joe Curran
    Ohio USA

    Please Log in or Create an account to join the conversation.

    Best Practices: Date conversion 10 Sep 2021 21:31 #19550

    • Jamal


  • Posts: 253
  • Joe,

    I think it is better to use the ISO Date type for the SQL column. The syntax is: YYYY-MM-DD
    VO 2.8 Sql Class Library has DToCSQL(dDate) to convert VO date to a SQL Date. You may also create your own functions to handle date and time values.
    for example:
    ? DToCSQL(Today())    // returns: 2021-09-10

    Using SQL date columns will make it to sort and query the data using SQL statements.

    Jamal

    Please Log in or Create an account to join the conversation.

    Last edit: by Jamal.

    Best Practices: Date conversion 11 Sep 2021 21:48 #19561

    • OhioJoe
    • OhioJoe's Avatar
    • Topic Author


  • Posts: 90
  • Thank you, Jamal
    Joe Curran
    Ohio USA

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1