473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Probleum in format function in vb.net

198 100+
Hi
i used the following format function in vb6.0 it works fine
Format(DTPFromDate & " 00:00:00", "dd/mm/yyyy HH:MM:SS AMPM")

but when i use same format function in vb.net it shows output like this
MM/dd/yyyy HH:MM:SS AMPM

please give some idea about vb.net format function

reGArds
varinder
May 21 '08 #1
7 2285
Plater
7,872 Expert 4TB
That format you listed does not appear to match correct formatting.
From what I can tell you want this format: "dd/MM/yyyy hh:mm:ss tt"
You should also be useing the DateTime object and it's .ToString() function.

.ToString("dd/MM/yyyy hh:mm:ss tt")

On second look it seems like you are trying to "mask out" the time values?
In which case just:
.ToString("dd/MM/yyyy")
would give you the date value.
May 21 '08 #2
veer
198 100+
Hi
Thanks for reply
but i am not understanding can you give an example

thanks in advance

That format you listed does not appear to match correct formatting.
From what I can tell you want this format: "dd/MM/yyyy hh:mm:ss tt"
You should also be useing the DateTime object and it's .ToString() function.

.ToString("dd/MM/yyyy hh:mm:ss tt")

On second look it seems like you are trying to "mask out" the time values?
In which case just:
.ToString("dd/MM/yyyy")
would give you the date value.
May 21 '08 #3
Plater
7,872 Expert 4TB
DTPFromDate is an instance of the datetime object yes?

DTPFromDate.ToString("dd/MM/yyyy hh:mm:ss tt")
or
DTPFromDate.ToString("dd/MM/yyyy")

if the start date was for "May 21st 2008, 9:51:30 AM" then the first one would print out:
"21/05/2008 09:51:30 AM"
And the 2nd one would print out:
"21/05/2008"
May 21 '08 #4
veer
198 100+
Hi
i use this query

sQuery = "Insert into " & txttablename.Text & " In '" & txtmaster.Text & "' select * from " & sTableName & " In '" & txtpath.Text & "\" & sArrayFolder(icount) & "\" & sDirFolder & "' where YP1VStartTime >= # " & Format(DTPFrom.ToString ("dd/MM/yyyy hh:mm:ss tt")) & " # and Yp1VEndTime <= # " & Format(DTPTo.ToString ("MM/dd/yyyy hh:mm:ss tt")) & " # "

it shows the error
"Overload resolution failed because no accessible 'ToString' accepts this number of arguments."
is there any method to show date with time like this i did this in vb6.0 using format function but not getting in vb.net

Yp1EStartTime >= #05/01/2008 12:00:00 AM# AND Yp1EEndTime <= #05/23/2008 11:59:59 PM#

thanks in advance




DTPFromDate is an instance of the datetime object yes?

DTPFromDate.ToString("dd/MM/yyyy hh:mm:ss tt")
or
DTPFromDate.ToString("dd/MM/yyyy")

if the start date was for "May 21st 2008, 9:51:30 AM" then the first one would print out:
"21/05/2008 09:51:30 AM"
And the 2nd one would print out:
"21/05/2008"
May 23 '08 #5
Plater
7,872 Expert 4TB
What kind of objects are DTPFrom and DTPTo? I thought they were DateTime objects.
Also, why are you using the Format() function still?
May 23 '08 #6
veer
198 100+
yes you are right
DTPFrom and DTPTo are date time object
because i want to access the value from access database lies between the two selected dates
and the value in column of access is like "22/05/2008 02:55:25" so that i want to set the fromat of time liest between 12:00:00 am to 11:59:59 pm
that's why i use the format function but it is not working in vb.net it works fine in vb6.0




What kind of objects are DTPFrom and DTPTo? I thought they were DateTime objects.
Also, why are you using the Format() function still?
May 24 '08 #7
Plater
7,872 Expert 4TB
Although I doubt your access is really "keeping" the dates as any format other then a datetime number:
DTPFrom.ToString ("dd/MM/yyyy hh:mm:ss tt"))
is already formatting them into the correct display format for that.


Those columns are Date/time fields in the database yes?
May 27 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Stuart McGraw | last post by:
I am looking for a VBA "format" or "template" function, that is, a function that takes a format string and a varying number of arguments, and substitutes the argument values into the format string...
11
by: shsandeep | last post by:
I used the following query to retrieve the date in dd-mon-yyyy format. db2 => SELECT RTRIM(CHAR(DAY(COVG_TYP_STRT_DT))) || '-' || RTRIM(MONTHNAME(COVG_TYP_STRT_DT)) || '-' ||...
2
by: veer | last post by:
hello expert i made a website which opens in ie6 and works fine but when i open it in ie7 it creates probleum the probleum is that i have a footer in my webpage , it automatically moves in the...
1
by: veer | last post by:
hello expert i made a programe in vb6.0 and i want to display the price in decimal format like e.g. 2323.90 i am sending my program line where i want to change the price format ls1Level =...
3
by: veer | last post by:
Hi i run this query it works fine Select Yp1VOp,count(*) as instrec into instrec from " & txttablename & " where Yp1EOp=Yp1VOp Group By Yp1EOp,Yp1Vop Order By Yp1EOp,Yp1VOp but when i put a...
4
by: veer | last post by:
hi i have programe in which works fine for seaching the data from a file but when the i want to seach the word like" mögen ". In this word " ö " has some other kind of shap and my programe did not...
2
by: veer | last post by:
Hi i made a programe in which i want to calculate the total time from a column but when i declare a variable having datatype is "date" then the default value in this variable is "12:00:00: and...
3
by: veer | last post by:
Hi i have some probleum in reading the data from .val extension file when i manually open the file in notepad and just click on file option -> save -> close the txt file and then read the data...
1
by: veer | last post by:
hi i think it's a silly question but i am very confused about this actually i made program on spell check.This is done by creating object of msword and then with the help of this object i create...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.