Deformat date and time maually

Hello,

How can get the numeric of date and time together and reverse it?

For example:

08/12/2023=81429 , 01:26:51=521158

I can use Format and Deformat to get each one separately, but what I want is to get the numeric value for date and time together ‘08/12/2023 01:26:51’ (same as excel and SQL) and reverse it to date/time format.

Thank you

Use capesoft StringTheory it has a couple of classes dealing with date and times to do just that

Yeah, so StringTheory has a pair of classes called StringFormat and StringDeformat. It slso supports Extended Pictures - basically just more picture formats than the base Clarion Set.

The timestamp format you are refering to is known as the Unix Epoch. This is either the number of seconds, or milliseconds, since Jan 1, 1970. I recommend using a REAL value for this number.

If you want to convert Unix Epoch time to a Clarion Date and Clarion Time (or vice versa) then StringTheory also has a class to do that. So storing the data as a single REAL value, or twin LONG values, is easy.

Thank you for your replies.
Actually I have Capesoft StringTheory version 1.91 with clarion 6.3, and unfortunately these functions are there.

Regards

MyDate = 81429
MyTime = 521158

DateFormatString = ‘<39>’& FORMAT(DAY(MyDate ),‘@n02’) &‘/’ & FORMAT(MONTH(MyDate ),‘@n02’) &‘/’ & FORMAT(YEAR(MyDate ),‘@n04’) &’ ‘& FORMAT(MyTime,’@T04’) & ‘<39>’

Thank you for your contribution, also I think

‘<39>’& FORMAT(MyDate ,‘@d06’) &’ ‘& FORMAT(MyTime,’@T04’) & ‘<39>’
will give the same result.

Regard

1 Like