473,321 Members | 1,622 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.

winapp: get the date in a given string

nev
251 100+
if i have "2007-01-01 00:00:00", how can i get the "2007-01-01" only?

and by the way, will this work?

dim str as string

str = datetimepicker.text
bindingsource.filter = "[field] ='" & str & "'"

note: field is datetime datatype
Jan 11 '08 #1
3 1196
From a DateTime variable, you can use ToString function with formating parameter like this:

Expand|Select|Wrap|Line Numbers
  1. DateTime dt = DateTime.Now;
  2. string extract = dt.ToString("dd/MM/yyyy");
  3.  
Hope this helps
Jan 11 '08 #2
Plater
7,872 Expert 4TB
I believe the DateTimePicker control will convert it's value to a DateTime object for you somewhere?
(If not DateTime mine = DateTime.Parse("2002-10-12 01:12:34") should work)
Then you can use the .ToString() explained above.
Jan 11 '08 #3
nev
251 100+
I believe the DateTimePicker control will convert it's value to a DateTime object for you somewhere?
(If not DateTime mine = DateTime.Parse("2002-10-12 01:12:34") should work)
Then you cna use the .ToString() explained above.
thank you for the update.
Jan 28 '08 #4

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

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
4
by: Robert Scarborough | last post by:
I have a Table in a Typed Dataset which contains a Date field called EventDate. I've ensured that the field is defined as Date as opposed to DateTime in the Typed Dataset. When I generate an...
3
by: Jon Davis | last post by:
The date string: "Thu, 17 Jul 2003 12:35:18 PST" The problem: // this fails on PST DateTime myDate = DateTime.Parse("Thu, 17 Jul 2003 12:35:18 PST"); Help? Jon
2
by: johndcal | last post by:
Hello All, I have a date value that I pull from a .csv file. After reading the file and storing the values in an array the value of the date could be found in $array, for example....
7
by: Richiep | last post by:
I am trying to get a UK format date of dd/mm/yyyy. Why does the following subroutine not return a valid date in a web form? The date returned is #12:00:00 AM# but the date I entered into the...
44
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
4
by: perryclisbee via AccessMonster.com | last post by:
I have dates of service for several people that range all over each month. ie: patient had dates of service of: 7/3/2006, 7/24/2006 and 7/25/2006. I need to create a new field via a query that...
9
by: Apollo1376 | last post by:
Hi, I have a vector<string> Date, which contains all the dates. I will be given a starting date and the ending date. I want to compare the 'staring date' with the dates in the Date vector. I am...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
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...
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: 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: 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.