473,321 Members | 1,667 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,321 software developers and data experts.

remove date second part

Hi, All,

I want to remove date second part or change second pard to 00 if second part
is not 00. For example, change 2/13/2007 2:30:15 PM to 2/13/2007 2:30 PM , or
change 2/13/2007 2:30:15 PM to 2/13/2007 2:30:00 PM, can anyone help this
out?

Thanks in advance,
Martin
Feb 13 '07 #1
4 2963
One way you could do this is:

' dt is your DateTime object with seconds

dt = dt.AddSeconds(-dt.Second)

==============
Clay Burch
Syncfusion, Inc.

Feb 13 '07 #2
You want something like this ?

Dim data As Date = DateTime.Now
Dim str As String = data.ToShortDateString & " " & data.ToShortTimeString
MessageBox.Show(str)

--

Tiago Salgado

http://weblogs.pontonetpt.com/tiagosalgado
http://www.foruns.org
http://www.portugal-a-programar.org
http://www.revista-programar.info

"martin1" <ma*****@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
Hi, All,

I want to remove date second part or change second pard to 00 if second
part
is not 00. For example, change 2/13/2007 2:30:15 PM to 2/13/2007 2:30 PM ,
or
change 2/13/2007 2:30:15 PM to 2/13/2007 2:30:00 PM, can anyone help this
out?

Thanks in advance,
Martin
Feb 14 '07 #3
Thank you. Clay

"ClayB" wrote:
One way you could do this is:

' dt is your DateTime object with seconds

dt = dt.AddSeconds(-dt.Second)

==============
Clay Burch
Syncfusion, Inc.

Feb 14 '07 #4
Thnak you very much. Tiago

Martin

"Tiago Salgado" wrote:
You want something like this ?

Dim data As Date = DateTime.Now
Dim str As String = data.ToShortDateString & " " & data.ToShortTimeString
MessageBox.Show(str)

--

Tiago Salgado

http://weblogs.pontonetpt.com/tiagosalgado
http://www.foruns.org
http://www.portugal-a-programar.org
http://www.revista-programar.info

"martin1" <ma*****@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
Hi, All,

I want to remove date second part or change second pard to 00 if second
part
is not 00. For example, change 2/13/2007 2:30:15 PM to 2/13/2007 2:30 PM ,
or
change 2/13/2007 2:30:15 PM to 2/13/2007 2:30:00 PM, can anyone help this
out?

Thanks in advance,
Martin
Feb 14 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rob | last post by:
Why is this not returning the right day or month? It gives me 5 when the rightnow variable gives a 18. import java.util.Calendar; public class Test { public static void main(String args) {...
1
by: Raghu | last post by:
Hello... I am running into a problem while running a query..can some1 help.. this is the query : ************** SELECT * from Table S where S.dtDate1 BETWEEN...
7
by: Marc Pelletier | last post by:
Hello, I have a table with a Day field, defined as smalldatetime. I am filling it from a CSharp application with the following code: DataRow r = dtStaDays.NewRow(); r= station_ID; r =...
2
by: Chuck | last post by:
Using a macro to output a query to an Excel file. Is there a way to automatically add todays date in the file spec? As: C:\Access Data\ & todays date.xls Chuck ....
5
by: Michael Søndergaard | last post by:
I Pascal there are a function for retriving the fractional part of a real number (Frac), I can't find any in the dotnet framework. The function needs to remove the integer part and keep only the...
2
by: ad | last post by:
Hi, How can we get the second or minute part of System time?
3
by: Riun | last post by:
Hi I need to import excel sheet to access - the sheets are stored everyday with the same name, but with the day's date at the end of the name to distinguish them. What code can one use to import...
3
by: bonymuscles | last post by:
Hi ppl... Hope ur havin a good day... here''s my doubt... I need to remove the decimal part of a number declared as DOUBLE. I can NOT change the type. I need to remove jus the decimal part......
1
pezholio
by: pezholio | last post by:
Hi, I've got two tables, one called events, which has an id field (eventid), a name field (eventname), a start date (datefrom) and an end date (date to), and another called events_to_grouptype,...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.