Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

69 views
Skip to first unread message

timepro timesheet

unread,
Aug 25, 2022, 11:28:00 AM8/25/22
to
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

Claudio H

unread,
Aug 25, 2022, 12:40:26 PM8/25/22
to

timepro timesheet

unread,
Aug 25, 2022, 9:36:42 PM8/25/22
to
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().....

Ariel Paredes

unread,
Aug 27, 2022, 12:25:17 PM8/27/22
to
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


timepro timesheet

unread,
Aug 27, 2022, 10:36:50 PM8/27/22
to
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
0 new messages