• convert cell value 'dd-mm-yyyy hh:mm' in excel to text

    From timepro timesheet@21:1/5 to All on Thu Aug 25 08:27:58 2022
    in a downloaded excel file, cell(21,14) is '07-22-2022 15:11:00'
    ( 'dd-mm-yyyy hh:mm' )

    my .prg:
    einvackdt:=osheet:cells(21,14):value
    -type('einvackdt') shows as 'T'
    it crashes at 'oridate= dtoc(date())+einvactdt' -and- 'oriackno=einvori+einvackdt' && (einvori is a string)

    -how to convert einvackdt to text/character/str

    thanks

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Claudio H@21:1/5 to All on Thu Aug 25 09:40:25 2022
    https://www.excel-easy.com/vba/date-time.html

    Claudio H

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From timepro timesheet@21:1/5 to Claudio H on Thu Aug 25 18:36:41 2022
    On Thursday, August 25, 2022 at 10:10:26 PM UTC+5:30, Claudio H wrote:
    https://www.excel-easy.com/vba/date-time.html

    Claudio H
    thanks claudio:

    please, would you also type the 'xhb syntax' to convert. data type 'T' to data type 'C'

    my example:
    'einvackdt:=osheet:cells(21,14):value' (Type T)
    ? einvackdt shows 17-04-2022 15:11:00
    einvackdt1=dtoc(einvackdt) WORKS but (obviously) gives only the date.
    i tried :
    xxx=str(einvackdt)
    xxx=substr(einvackdt,11,6) && THIS CRASHES
    xxx=val(einvackdt) && gives 0
    xxx=right(einvackdt,8)
    but xxx does not show '15:11:00'

    is there a func similar to dtoc() like a ttoc().....

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ariel Paredes@21:1/5 to All on Sat Aug 27 09:25:16 2022
    El jueves, 25 de agosto de 2022 a las 20:36:42 UTC-5, timec...@gmail.com escribió:
    On Thursday, August 25, 2022 at 10:10:26 PM UTC+5:30, Claudio H wrote:
    https://www.excel-easy.com/vba/date-time.html

    Claudio H
    thanks claudio:

    please, would you also type the 'xhb syntax' to convert. data type 'T' to data type 'C'

    my example:
    'einvackdt:=osheet:cells(21,14):value' (Type T)
    ? einvackdt shows 17-04-2022 15:11:00
    einvackdt1=dtoc(einvackdt) WORKS but (obviously) gives only the date.
    i tried :
    xxx=str(einvackdt)
    xxx=substr(einvackdt,11,6) && THIS CRASHES
    xxx=val(einvackdt) && gives 0
    xxx=right(einvackdt,8)
    but xxx does not show '15:11:00'

    is there a func similar to dtoc() like a ttoc().....

    Try

    TtoC()
    Converts a DateTime value to a character string in SET DATE and SET TIME format.
    Syntax
    TtoC( <dDateTime> ) --> cDateTimeString
    Arguments
    <dDateTime>
    The parameter must be a value of data type Date or DateTime.
    Return
    The return value is a character string formatted in the current SET DATE and SET TIME format.
    Description
    The function converts a DateTime value to a character string. The string is formatted according to the current SET DATE and SET TIME format.
    Important: use TtoC() and its counterpart CtoT() with extreme care. The result of both functions depends on the current SET DATE, SET EPOCH and SET TIME settings.
    Info
    See also: DateTime(), DtoC(), SET CENTURY, SET DATE, SET EPOCH, SET TIME, StoT(), TtoC(), TtoS()
    Category: Conversion functions, Date and time, xHarbour extensions
    Source: rtl\dateshb.c
    LIB: xhb.lib
    DLL: xhbdll.dll
    1842

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From timepro timesheet@21:1/5 to arielso...@gmail.com on Sat Aug 27 19:36:49 2022
    On Saturday, August 27, 2022 at 9:55:17 PM UTC+5:30, arielso...@gmail.com wrote:
    El jueves, 25 de agosto de 2022 a las 20:36:42 UTC-5, timec...@gmail.com escribió:
    On Thursday, August 25, 2022 at 10:10:26 PM UTC+5:30, Claudio H wrote:
    https://www.excel-easy.com/vba/date-time.html

    Claudio H
    thanks claudio:

    please, would you also type the 'xhb syntax' to convert. data type 'T' to data type 'C'

    my example:
    'einvackdt:=osheet:cells(21,14):value' (Type T)
    ? einvackdt shows 17-04-2022 15:11:00
    einvackdt1=dtoc(einvackdt) WORKS but (obviously) gives only the date.
    i tried :
    xxx=str(einvackdt)
    xxx=substr(einvackdt,11,6) && THIS CRASHES
    xxx=val(einvackdt) && gives 0
    xxx=right(einvackdt,8)
    but xxx does not show '15:11:00'

    is there a func similar to dtoc() like a ttoc().....
    Try

    TtoC()
    Converts a DateTime value to a character string in SET DATE and SET TIME format.
    Syntax
    TtoC( <dDateTime> ) --> cDateTimeString
    Arguments
    <dDateTime>
    The parameter must be a value of data type Date or DateTime.
    Return
    The return value is a character string formatted in the current SET DATE and SET TIME format.
    Description
    The function converts a DateTime value to a character string. The string is formatted according to the current SET DATE and SET TIME format.
    Important: use TtoC() and its counterpart CtoT() with extreme care. The result of both functions depends on the current SET DATE, SET EPOCH and SET TIME settings.
    Info
    See also: DateTime(), DtoC(), SET CENTURY, SET DATE, SET EPOCH, SET TIME, StoT(), TtoC(), TtoS()
    Category: Conversion functions, Date and time, xHarbour extensions
    Source: rtl\dateshb.c
    LIB: xhb.lib
    DLL: xhbdll.dll
    1842

    thank you ariel:

    i believe experimenting with ttoc(), but linking crashed.
    -or, maybe i had typed toc() instead of ttoc() in my prg.
    anyhoo, i will try now with ttoc(einvackdt) // einvackdt=17-04-2022 15:11:00 (set epoch to 1960, set cent on). but i have not 'set time'

    regards

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)