Initializing Date Time variable to null

Dear Team,

How to Assign null value or blank space for a Date Time Variable.

Tried with Initializing with Nothing but coming with a default value 00-01-1900 instead of this i Need Blank data


It looks like you cannot have a null value for a regular datetime variable, it defaults to that 00-01-1900.

I am not sure about your use case, but you can set the variable type to Nullable, and then do the initial assignment:

datetime = new nullable(of datetime)

It returns a blank value for me. This will mean that the value can be null, which might not be the best solution for you, so check if it makes sense to you.

1 Like

Hi @S Savickas

Getting error has
option strict on disallows implicit conversions from ‘Date?’ to ‘Date’
where my variable is of type system.DateTime

A Manohar

Hello @Manohar1
You can change datatype datetime to Nullable


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.