Format problem

New to FreeBASIC? Post your questions here.
Posts: 1049
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom

Format problem

Postby Gablea » Apr 28, 2010 17:04

Hi all,

I need some advice

I am trying to get a program to display the time & date on screen BUT when I use the following bit of code to display the time & data

Dim DateDis As String
Dim TimeDis As String

DateDis = Format(Now,"DD/MM/YYYY")
TimeDis = Format(Now,"HH:MM")

I get the following error message(s)

C:\FBC_WIN\fbc -g -s console "FbTemp.bas"
FbTemp.bas(476) error 41: Variable not declared, Format in 'DateIn = Format(Now,"DD/MM/YYYY")'
FbTemp.bas(476) warning 12(0): Implicit variable allocation, Format
FbTemp.bas(477) error 67: Array not dimensioned, before '(' in 'TimeDis = Format(Now,"HH:MM")'

Build error(s)

What am i doing wrong?

Posts: 1201
Joined: May 05, 2006 16:12
Location: West Richland, Wa

Postby phishguy » Apr 28, 2010 17:17

You need to add

Code: Select all

#include ""

to the beginning of your program for the format command to work.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 5 guests