Date Conversions

  • Thread starter Thread starter Charles A. Lackman
  • Start date Start date
C

Charles A. Lackman

Hello,

I am saving a date with milliseconds into the Registry:

Dec 01 2007 9:12:34:960PM
Registry = Format(Date.Now, "MMM dd yyy h:mm:ss:ffftt")

This works great, but when I try to make a variable (Date) out of what is
saved, I get an error:

"Not a Date"

Dim ADate as Date (or DateTime)

ADate = Format(Registry, "MMM dd yyy h:mm:ss:ffftt")

This works:

ADate = Format(Registry, "MMM dd yyy h:mm:ss tt")

When I add Milliseconds the conversion fails.

Any Assistance Is Greatly Appreciated,

Thanks,

Chuck
 
Hello,

if you just want to save the date for a roundtrip (save now, restore later),
and the form of the date is irrelevant, you could just save the
DateTime.Ticks to the registry.

Kind regards,
Henning Krause
 
Charles said:
Hello,

I am saving a date with milliseconds into the Registry:

Dec 01 2007 9:12:34:960PM
Registry = Format(Date.Now, "MMM dd yyy h:mm:ss:ffftt")

This works great, but when I try to make a variable (Date) out of what is
saved, I get an error:

"Not a Date"

Dim ADate as Date (or DateTime)

ADate = Format(Registry, "MMM dd yyy h:mm:ss:ffftt")

This works:

ADate = Format(Registry, "MMM dd yyy h:mm:ss tt")

When I add Milliseconds the conversion fails.

Any Assistance Is Greatly Appreciated,

Thanks,

Chuck

What do you use to obtain the date? DateTime.Parse?
 
Back
Top