Format for blank res. for zero Date format 
Author Message
 Format for blank res. for zero Date format

Hi All!

Larry and Bruce helps me about blank result for numeric
format ( Thank you ).
But, is There any DATE format, for appears blank text ,
when date variable =0?
 DateVar = 0
 Text1.Text = Format(DateVar,"dd.MM.yyyy HH:mm:ss:??????");

Thanks more



Tue, 11 Jan 2005 18:41:17 GMT  
 Format for blank res. for zero Date format
Why don't you just try it? Date = 0 is a valid date: 30 December 1899
00:00:00


Quote:
> Hi All!

> Larry and Bruce helps me about blank result for numeric
> format ( Thank you ).
> But, is There any DATE format, for appears blank text ,
> when date variable =0?
>  DateVar = 0
>  Text1.Text = Format(DateVar,"dd.MM.yyyy HH:mm:ss:??????");

> Thanks more



Tue, 11 Jan 2005 20:08:43 GMT  
 Format for blank res. for zero Date format
Can you clarify what you are doing a little bit more. Normally, you
would not assign the number zero to a variable declared as a type Date.
Is the DateVar variable actually declared as Date? Are you actually
writing in code DateVar = 0? What does a non-zero date assignment look
like in your code (for example, how would you assign July 26, 2002 to
DateVar)? Where does the value that is being assigned to DateVar come
from? A database? A text file? A TextBox entry?

Rick


Quote:
> Hi All!

> Larry and Bruce helps me about blank result for numeric
> format ( Thank you ).
> But, is There any DATE format, for appears blank text ,
> when date variable =0?
>  DateVar = 0
>  Text1.Text = Format(DateVar,"dd.MM.yyyy HH:mm:ss:??????");

> Thanks more



Tue, 11 Jan 2005 21:07:58 GMT  
 Format for blank res. for zero Date format
You are quite right !
When I use following source code

Dim datevar As Date
    datevar = 0
    Text1.Text = Format(datevar, "dd.MM.YYYY")

Result is: 30.12.1899

Is Thet any format, in this case (when datevar = 0), for
appears blank text.

Thanks.

Quote:
>-----Original Message-----
>Can you clarify what you are doing a little bit more.
Normally, you
>would not assign the number zero to a variable declared
as a type Date.
>Is the DateVar variable actually declared as Date? Are
you actually
>writing in code DateVar = 0? What does a non-zero date
assignment look
>like in your code (for example, how would you assign July
26, 2002 to
>DateVar)? Where does the value that is being assigned to
DateVar come
>from? A database? A text file? A TextBox entry?

>Rick



>> Hi All!

>> Larry and Bruce helps me about blank result for numeric
>> format ( Thank you ).
>> But, is There any DATE format, for appears blank text ,
>> when date variable =0?
>>  DateVar = 0
>>  Text1.Text = Format(DateVar,"dd.MM.yyyy
HH:mm:ss:??????");

>> Thanks more

>.



Fri, 14 Jan 2005 13:24:12 GMT  
 Format for blank res. for zero Date format

Quote:
> You are quite right !
> When I use following source code

> Dim datevar As Date
>     datevar = 0
>     Text1.Text = Format(datevar, "dd.MM.YYYY")

> Result is: 30.12.1899

> Is Thet any format, in this case (when datevar = 0), for
> appears blank text.

Not in a single statement; but, since you are using a TextBox, something
like this should work...

     If datevar = 0 Then
        Text1.Text = ""
     Else
        Text1.Text = Format(datevar, "dd.MM.YYYY")
     End If

However, I still question your using

     datevar = 0

when datevar is a Date type variable. Would you ever consider doing this

     datevar = 37466

to assign today's date to the datevar variable? The assignment to a Date
type variable **should** be a date, not a number.

Rick



Sat, 15 Jan 2005 00:33:11 GMT  
 Format for blank res. for zero Date format
I want just include your example:
     If datevar = 0 Then
        Text1.Text = ""
     Else
        Text1.Text = Format(datevar, "dd.MM.YYYY")
     End If

in one format line, like in another lenguage (f.e. Clarion)
        Text1.Text = Format(datevar, "dd.MM.YYYYb")

Is it possible ?



Sat, 15 Jan 2005 15:23:59 GMT  
 Format for blank res. for zero Date format

Quote:

> Can you clarify what you are doing a little bit more. Normally, you
> would not assign the number zero to a variable declared as a type Date.
> Is the DateVar variable actually declared as Date? Are you actually
> writing in code DateVar = 0? What does a non-zero date assignment look
> like in your code (for example, how would you assign July 26, 2002 to
> DateVar)? Where does the value that is being assigned to DateVar come
> from? A database? A text file? A TextBox entry?

Just to be silly?

for each d in array(null, 0, #1899-12-29#, #1899-12-31#)
  debug.print format$(d, _
    "yyyy-mm-dd hh:nn:ss;""long, long ago in a galaxy far, far away"";""gonna party like it's ""yyyy;""don't know, don't care""")
next

--
Joe Foster <mailto:jlfoster%40znet.com>     On the cans? <http://www.xenu.net/>
WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!



Sat, 15 Jan 2005 15:50:22 GMT  
 Format for blank res. for zero Date format
Quote:
> > Can you clarify what you are doing a little bit more. Normally, you
> > would not assign the number zero to a variable declared as a type
Date.
> > Is the DateVar variable actually declared as Date? Are you actually
> > writing in code DateVar = 0? What does a non-zero date assignment
look
> > like in your code (for example, how would you assign July 26, 2002
to
> > DateVar)? Where does the value that is being assigned to DateVar
come
> > from? A database? A text file? A TextBox entry?

> Just to be silly?

> for each d in array(null, 0, #1899-12-29#, #1899-12-31#)
>   debug.print format$(d, _
>     "yyyy-mm-dd hh:nn:ss;""long, long ago in a galaxy far, far

away"";""gonna party like it's ""yyyy;""don't know, don't care""")

Quote:
> next

<g>

Rick



Sat, 15 Jan 2005 16:02:54 GMT  
 Format for blank res. for zero Date format

Quote:
> I want just include your example:
>      If datevar = 0 Then
>         Text1.Text = ""
>      Else
>         Text1.Text = Format(datevar, "dd.MM.YYYY")
>      End If

> in one format line, like in another lenguage (f.e. Clarion)
>         Text1.Text = Format(datevar, "dd.MM.YYYYb")

> Is it possible ?

Why??? There is nothing magical about the number of statements being
used. With that said, yes, it can be done in one line...

Text1.Text = IIf(datevar, Format(datevar, "dd.MM.YYYY"), "")

Rick



Sat, 15 Jan 2005 16:01:26 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Format "blank when zero"

2. formatting a text box to long date format

3. How to convert number format to date format

4. Date Format Style/format

5. problem with Format and a user defined date format

6. Type Mismatch with Format Function & Preceding Zeros

7. Formatting Zero

8. Way to format a number with leading zeroes?

9. How to format a number that is without thousand separator and with leading zeros

10. Help formatting longs with leading zeros

11. Formatting For Next with leading zeros

12. Date formatting of date type

 

 
Powered by phpBB® Forum Software