Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




[VB6] Converting A Date String To Date Variable


Hi

I have some of the tutorial on how to convert string to date. But I find my problem abit different.

I have a log file that provide info in this form:


Thu Jul 9 11:00:00 GMT 2008 Some other Messages, length varies
Thu Jul 10 12:00:55 GMT 2008 More messages...

I tried to apply


Code:
dim date1 as date
date1 = #Thu Jul 9 11:00:00 GMT 2008#
but it's giving me error, i guess the compiler is not able to interpret it.
Plus I when the day is single digit there is 2 white space instead of 1 when on a 2digit day

So I will like to seek help on how to make it possible. Thanks.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Converting A String To Date In VB 6
How can I convert the text: "20041020080000" to read 10/20/2004 8:00:00 AM. Im using VB 6.

Converting Date To String?
How do you convert a date variable into a string?

Converting Date To String
anyone help, how can i convert date into string format?

Converting Date Into Useful String
I need to convert date mo/dy/yr to three individual pieces of data


lblmonth = mo
lblday = dy
lblyear = yr

something like

lblmonth = Left$(date, 2)
lblDay = left$(date, 5, 3)
lblyear = end$(date, 2)

don't believe what was just type is accurate though.

Converting A String To A Date
Hi all,

I have a string value read in from a file, which I need to either store in a date variable or convert to a date.  The string read in is in the format YYYYMMDDHHMMSS, i.e 20060509140900 would be today at 14:09.  I have tried using the format function to convert this, i.e

myDateVar = format (myStringVar, "DD/MM/YYYY HH:MM:SS")

When it gets to this line however, I get an "overflow" error.  Anyone any ideas how I can get around this?

Thanks

Converting Date To String Format
Hi,

My situation goes like this: I have two databases, archive.mdb and main.mdb. Main.mdb is the main database in which all transactions are being inputted. Archive.mdb is where old transactions are being archived. Both has tables named tblTimeEntry. tblTimeEntry has a particular field called PostDate. Let's say that archive.mdb is initially empty. The PostDate field in main.mdb may have blank/empty values in it, and so the problem arises when I try running the program and it detects a null situation. I currently have these lines in my program:


Dim datPost as Date
:
:

'datPost takes the value of PostDate from main.mdb to be passed to an SQL statement

If Not IsNull(ADORs.Fields.Item(9).Value) Then
datPost = ADORs.Fields.Item(9).Value
Else
MsgBox "There is a null value in PostDate..."
End If

:
:

What I wanted to happen was still to copy each record despite having a blank/empty PostDate field, and when it does get transferred to archive.mdb, I would like the PostDate field to STILL be empty/blank, and not display any other. Because in my case right now, the record DOES get transferred to archive.mdb, however, the PostDate field has a 12:00AM shown on it. So I'm planning to convert datPost to string first, and then maybe kind of check that string itself for a specific value in order for it to work. I am not quite sure about this approach... I would greatly appreciate any suggestion from you. Thank you very much in advance.

Converting String To Date For Comparison
I have two strings eg. "MAR2007" and "JAN2008"

I want to get the difference in months between these two dates. I think I need to convert the strings to a date format and then use datediff function to work out the difference? Unsure about which functions to use to do this.

Thanks in advance.

Converting A String To A Date/Time
I have in a string "10:40 AM".
I would like to covert the "10:40 AM" to a Date/Time or double.

Reason:

To get the DateDiff between "10:40 AM" and Now/Time.


Thanks in advance.

Converting String To DATE & TIME
In VB there are many functions available to convert strings to date for eg.

DateValue, cdate . If these functions were fed in with a string containing date and time in the format "dd.mm.yyyy hh:mm:ss" These functions convieniently dropout the time part and convert the date only. for example

? datevalue("01.12.2001 13:50:12")
01.12.2001 ' Drops pot the time

? Cdate("01.12.2001 13:50:12")
01.12.2001 13:50:12 ' this one doesnt drop out the time but doesnt have any regard for it I mean

Cdate("01.12.2001 13:50:12") = Cdate("01.12.2001 21:50:12") is the same. I hope u understand what i mean.

Can anyone tell me some function which actually regards a difference in the time too ?

Regards

Nikhil

Converting String To Date For YTD Filter
I'm trying to display YTD Tot_Sales. In the Data Environment Designer I created an expression that tried to convert del_date (8 char., string, yyyymmdd) and find it in YTD. It seemed so simple. But I continously received an invalid scalar function error. Pervasive's website acknowledged the problem and will consider a fix in the next version. How can I work around this? I considered using Left (del_date, 4) and comparing it with the system year. What do you think of that?

Converting String To Date:: I Know This Should Be Easy!
hey, can anybody help me with this? i thought i should be able to convert from a string to a date using cdate but it doesn't seem to be working.

here is what i am doing: i am building a date, and then i need to use the month() function to continue building the date.

so, what i actually have is somthing like this:::

xdate is a string, as in = "01/01/2001"
xmonth = month(xdate)
xyear = year(xdate)
xday = day(xdate)

(then i have code that adjusts the numbers of xmonth, xyear, and xday based on some rules)

next, i put the new date together, as in:::
newdate = xMonth & "/" & xDay & "/" & xYear

now, i need to be able to look at the month(newdate) and i keep getting type mismatch.

so i tried declaring newdate "as date" and i also tried using cdate(newdate) -- neither works.

any ideas?

thank you! heather

Converting From String To Date Object
Hi,

How to convert string format to Date object

my task is something like this

str = #10/15/1970#
I want to convert to Date object
How to convert this string to date object

thanks and regards

Prashanth

Converting And Searching By Date Stored As String.
Hello, group.
I am using a date field that is stored as a string as criteria for anupdate in an Access database and the following works perfectly for me.I am using the Mid function to format the date and then converting itusing the CDate function.

For i = 1 To 3

strSQL = "UPDATE LocalDemoTable SET LocalDemoTable.Relation"& j & " = '03' WHERE ((("
strSQL = strSQL & "LocalDemoTable.InsrdName" & j & ")<>"
strSQL = strSQL & "'') AND ((CDate(Mid([DOB],1,2) & '/' & "
strSQL = strSQL & "Mid([DOB],3,2) & '/' & Mid([DOB],5,4))) "
strSQL = strSQL & "Between Date() And (Date()-6574)) AND (("
strSQL = strSQL & "LocalDemoTable.DOB)<>'') "
strSQL = strSQL & "AND " & strSites & " AND (("
strSQL = strSQL & "LocalDemoTable.SystemNum)=" &varSystemNum
strSQL = strSQL & ") AND ((LocalDemoTable.DivisionID)= '"
strSQL = strSQL & varDivisionID & "'))"

Next i

Just a little input.
Kitty Boone

Converting A String Value To Date Format (RESOLVED)
I NEED TO COMPARE TWO DATES WHICH ARE STORED AS STRING VARIABLES, DO I USE CDATE OR DATEVALUE TO CONVERT SUCH? AT PRESENT I AM USING CDATE BUT NOT SURE WHETHER THIS IS APPROPRIATE.
Example: If CDate(RemStartDate) >= CDate(EXREMSTARTDATE) Then
    PLEASE ADVISE
        THANKS




Edited by - KAB on 12/14/2004 1:22:58 AM

How To Convert String Variable To Date Variable
While trying out with the following codes I am getting Type mismatch.






Public Wrkstdt As String
Public Wrksthr As String
Public StartDt As Date






StartStr = Wrkstdt & " " & Wrksthr
StartDt = DateValue(StartStr)



Values of Wrkstdt & Wrksthr are "29122002" & "1015".

Converting Short Date To Medium Date In VB
i'm saving my dates in medium date format from VB, however, when I use a MSHFlexgrid, it shows the date as a shortdate format. In my double click event of the grid, it grabs the information from the flexgrid and puts it into a form. My problem lies in the format. It's no longer medium date but short date. Is there a possible way to convert the dates to a medium date format??


thanks

INputBox (Cancel Button When Variable Is Date Instead Of String)
can someone please help me with this small problem, Im doing a prog to shutdown my computer like on a certain time but im having this little trouble with a inputbox


VB Code:
Dim Trigger As StringTrigger = InputBox("Input a time for your computer to power down. 24 Hour Format, e.g. 14:20:00 = 2:20:00 PM") 'retrieve the deadline from the user If StrPtr(Trigger) = 0 Then     MsgBox "cancel button"    Exit Sub Else    ShutDown = TruelblStatus.Caption = "Status: Activated!"lblShutDown.Caption = "Shutdown: " & Trigger 'Update shutdown labelcmdEnabled.Enabled = FalsecmdDisabled.Enabled = True End If


the above method works perfectly however when I change the


VB Code:
Dim Trigger As String

to

VB Code:
Dim Trigger As Date


it doesnt work, it continues the process through the whole sub, can anyone suggest a working solution to this?

Replace Date Text With Printed %date:~4% Variable
Currently I have a .vbs script for a customer of mine that works fine, its a scheduled backup that runs every 12 months. Since they are growing a little we are looking to trim down to 6 months. This is no problem. We are using the following code to do this.


Code:


dim startdate
dim duration

startdate = #11/20/2004#
duration = 12

if dateadd("m",duration,startdate) < date() then



Where after then it runs a backup script that again works perfect. Currently since they were only running once a year we had some more code that would change the startdate as shown below.. This also works perfect.


Code:


Const ForReading = 1
Const ForWriting = 2

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("backup.vbs", ForReading)

strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "11/01/2004", "11/01/2005")

Set objFile = objFSO.OpenTextFile("backup.vbs", ForWriting)
objFile.WriteLine strNewText
objFile.Close



What we are trying to do now, is replace the 2nd part with the current date variable %date:~4% which would print exactly how we need. This would allow us to easily switch to 3 month backups and even 1 month a lot easier, as they grew. The only problem I am having is printing a permanent variable result IE %date:~4% = 12/31/2005 and using that in the 2nd part, rather than what seems to be happening now is %date:~4% is literally replaced, and that of course does no good as the variable is changed everyday.

What I am looking for help with is how to make %date:~4% show up as an actual date in the .vbs

Thanks ahead of time for any help

Matthew

Date &amp; Time Values In Date And String Format Differ
The program (debug) output below lists the last modification time of two files. File 1 is stored on a NTFS medium, file 2 sits on a FAT medium.

In order to be able to compare these dates, I need to round the odd seconds of the NTFS file up (FAT files have only even second values).

The lines after the file headers show the date & time value before and after the rounding, in date, double precision and string format.

file 1 (NTFS)
= 2005-07-12 08:57:09 = 38545,3730208333 = 2005-07-12 08:57:09
after rounding up
= 2005-07-12 08:57:10 = 38545,3730324074 = 2005-07-12 08:57:10

file 2 (FAT)
= 2005-07-12 08:57:10 = 38545,3730324074 = 2005-07-12 08:57:10

The strange thing is that when comparing these values, they appear to be different (!) both in date and double data format, not in string format.

2005-07-12 08:57:10 > 2005-07-12 08:57:10 (date format)
38545,3730324074 > 38545,3730324074 (double precision format)
2005-07-12 08:57:10 = 2005-07-12 08:57:10 (string format)

Any idea where this difference comes from?

Rounding up was done with DateAdd.

VB version 6, on XP.
Boiled down code has been attached.

String Date To Date Var, Mixed Locales
Is there anyway to tell VB "here is a string, it's got a date in it whose format is d/MM/yyyy, put it in a date var for me" when the machine it's running on is using a regional setting of MM/dd/yyyy?

I have already solved this problem by using the incoming date's format and mapping the incoming date parts to a string in the order of the machine's regional format. But this is really messy.

I have already tried on my MM/dd/yyyy machine running:

Dim dDate as Date
dDate = format("2/11/2003","dd/MM/yyyy")

and thought maybe dDate would contain "11/2/2003", or essentially "November 2, 2003", but it does not. (Don't try it with days higher than 13 or it will actually do it because MS is so smart.)

Balasan: Convert Date To String Date
txtTest.Text = format$(rsTest!SampleField, "dd/mm/yyyy")

Best Regards,
Ade Aan Wirama
Coding for Humanity - We do coding for humanity
** to join, send blank email to email@removed

Date String To Oracle Date Datatype
I have variable that holds a date string looking like this: '05312002140059'
[The format is read as: 'mm/dd/yyyy hh24:mi:ss']. I need to execute a stored procedure
in Oracle through VB. The date string comes from a tab delimited text file, which is
read into a string variable in VB. From there, I want to assign the value in the
string varible to the Command object's parameters. The error that I'm getting is
that the string's datatype is mismatched or invalid with the stored procedure's
data type. What am I doing wrong?!

Convert Date To String Date
Hai,

How can i convert a date field to a character date to display in
a text box from access table (forma is "dd/mm/yyyy")

Julian Date String To Date
My program is receiving a julian date string in the following format:

'YYDDDHH24MI'

I need to create a variable of type Date with that value. I don't think DateSerial would work, or would it?

Anyone have any quick sample code for this?

Thanks,

Tim

DATE Problems - Change Date Format To European, Get Current Date, Subtract 2 Dates?
Need someone to point me in the right direction/start me off with this please as I am quite clueless on it at present...

I need something that can successfully subtract two dates...


eg. calculate the difference between the current date
02/04/04 (2nd April 04) and 29/03/04 (28th March 04)
...
which will then output a result of 5 days


So what I need to know is...

1.
I need to know how to get the current date from the system clock

2.
I must somehow get my date function converted into European date format (as at present it is in USA format ie. 2nd April 04 is 04/02/04 like April 2nd 04 which is not good!)

3.
and then I must actually SUBTRACT the 2 dates (the current date and a date that is given) from each other to give an integer which I can then use (ie. a value like 5 or 15).


But I have little idea how to go about this


Can anyone please start me off?

DATE Problems - Change Date Format To European, Get Current Date, Subtract 2 Dates?
Need someone to point me in the right direction/start me off with this please as I am quite clueless on it at present...

I need something that can successfully subtract two dates...


eg. calculate the difference between the current date
     02/04/04 (2nd April 04) and 29/03/04 (28th March 04)
     ...
     which will then output a result of 5 days


So what I need to know is...

1.
I need to know how to get the current date from the system clock

2.
I must somehow get my date function converted into European date format (as at present it is in USA format ie. 2nd April 04 is 04/02/04 like April 2nd 04 which is not good!)

3.
and then I must actually SUBTRACT the 2 dates (the current date and a date that is given) from each other to give an integer which I can then use (ie. a value like 5 or 15).


But I have little idea how to go about this


Can anyone please start me off?

Every Record Has A Date Field. I Want To Find A Date And From This Date, I Want To Read Records To E
Every record has a date field. I want to find a date and from this date, I want to read records to eof. What is the code? - Thanks

DATE Problem - Formatting US Date MM/DD/YY To European Date Format DD/MM/YY
I have a problem whereby the user must enter a date into a field...

The system changes the date format to US standard which is MM/DD/YY
but I need to change the format to DD/MM/YY (European standard)


I have done this using the Format function, but I still have a slight problem
Format(mydate,"dd/mm/yy")

doesnt account for all dates...

for example...
if I enter 31/03/04 this is fine, it will accept it as that

However, if I enter 02/04/04 (todays date - 2nd April 04), it will change it to 04/02/04



Any ideas how I can counter this from happening?

Query With Date Ranges And Return Only Closest Date To 'to Date'
I am using an access db...

I am trying to pull back due dates for credit reports for clients. I have 4 tables I am working with for this query...

    [Client_info]
    [Dispute_track_eq]
    [Dispute_track_exp]
    [Dispute_track_trans]

[Client_info] has the basic client information....ID, SSN, name, telephone_numbers, yadd yadda..
    each of the other tables hold the fields I am pulling from(other fields as well but these are the ones i need)...

    [Dispute_track_eq].eq_due_date
    [Dispute_track_exp].exp_due_date
    [Dispute_track_trans].trans_due_date

Here is my problem...
    I have variable that are set by dtpickers...'from_date' and 'to_date'. I am trying to get back each of these due dates that fall between the ranges set along with the [client_info] data linked by the SSN field. The problem is that sometimes these clients will have multiple due_dates(multiple rows) between the range. What the end result needs to be is this, I need to only have one record to come back with one of each due_date from each table, but only give me back the closest due_date to the 'to_date'(set by dtpicker) as well as the data from the [Client_info] table. And if there are no records for one or two but not the thirs field, an empty fields is ok(using a datagrid). But I can only pull back one row with the [client_info] fields, and one of each of the 3 due date fields. I have a query already but it doesnt even come close to working, it gives me many duplicates and doesnt give me the closest due_date to the 'to_date'.

Here is my query, but it doesnt work. Any help would be greatly appreciated, I am in dire need of help on this one.

Code:Private Sub Command4_Click() '***Due dates report grid date
    to_date = dt2.Value
    from_date = dt1.Value
    If from_date = vbNull Then
            MsgBox "Please select a FROM DATE"
            Exit Sub
        ElseIf to_date = vbNull Then
            MsgBox "Please select a TO DATE"
            Exit Sub
    Else
    Dim ID_new As String
    Dim cn As ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim strSQL As String
    Dim ID_pass As String
    Dim active As String
    
    active = "Active-Negotiations"
   
    Set rs = New ADODB.Recordset
    
    
        strSQL = "Select" & vbNewLine
        strSQL = strSQL & " [client_info].[FirstName], [client_info].[LastName], [client_info].[HomePhone], [client_info].[MobilePhone], [client_info].[Client_status], [client_info].[Category], [client_info].[Appt_notes],[client_info].[Appt_date],[client_info].[Appt_date_time], " & vbNewLine
        strSQL = strSQL & " [dispute_track_eq].[eq_due_date], [dispute_track_exp].[exp_due_date], [dispute_track_trans].[trans_due_date]" & vbNewLine
        strSQL = strSQL & " FROM (dispute_track_exp INNER JOIN (dispute_track_eq INNER JOIN client_info ON [dispute_track_eq].[SSN] =[client_info].[SSN]) ON [dispute_track_exp].[SSN] =[client_info].[SSN]) INNER JOIN" & vbNewLine
        strSQL = strSQL & " dispute_track_trans ON [client_info].[SSN] =[dispute_track_trans].[SSN]" & vbNewLine
        strSQL = strSQL & " Where (dispute_track_trans.trans_due_date > #" & from_date & "# And" & vbNewLine
        strSQL = strSQL & " dispute_track_trans.trans_due_date < #" & to_date & "#)" & vbNewLine
        strSQL = strSQL & " OR (dispute_track_eq.eq_due_date > #" & from_date & "# And" & vbNewLine
        strSQL = strSQL & " dispute_track_eq.eq_due_date < #" & to_date & "#)" & vbNewLine
        strSQL = strSQL & " OR (dispute_track_exp.exp_due_date > #" & from_date & "# And" & vbNewLine
        strSQL = strSQL & " dispute_track_exp.exp_due_date < #" & to_date & "#) AND NOT NULL"


    Set cn = New ADODB.Connection
    With cn
           .Provider = "Microsoft.Jet.OLEDB.4.0"
           .ConnectionString = "Data Source= " & db & " "
           .open
    End With
    
    Set rs = New ADODB.Recordset
    With rs
        .ActiveConnection = cn
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
        .Source = strSQL
        .open
    End With
        
        If rs.RecordCount = 0 Then
            MsgBox "Sorry, no one matched that status, try again", vbOKOnly, "Credit Matrix"
            Set DataGrid1.DataSource = rs
        Else
            Set DataGrid1.DataSource = rs
    
        End If
        End If

    I would be forever in your debt for helping me as I am almost out of hair....FROM PULLING IT OUT!!
    



Edited by - ronmegga on 4/1/2004 5:26:03 PM

DATE Problem - Formatting US Date MM/DD/YY To European Date Format DD/MM/YY
I have a problem whereby the user must enter a date into a field...

The system changes the date format to US standard which is MM/DD/YY
but I need to change the format to DD/MM/YY (European standard)


I have done this using the Format function, but I still have a slight problem
Format(mydate,"dd/mm/yy")

doesnt account for all dates...

for example...
if I enter 31/03/04 this is fine, it will accept it as that

However, if I enter 02/04/04 (todays date - 2nd April 04), it will change it to 04/02/04



Any ideas how I can counter this from happening?

Converting Date
Hi,

I'm having a little problem with a date.

This is the normal date format that my Access database uses:

dd/mm/yyyy , right?

But I want to convert this thing to:

yyyy/mm/dd , so far so good?

What I want to do is that each time user will go on the textbox, the format date will change from dd/mm/yyyy to yyyy/mm/dd. Is that complicated. Would it be like:

private sub txtinfo_gotfocus()

I do the fallowing statement?

end sub

How could I convert the date to that fallowing statement.

It may be dumb, but it's important in my program, and I'm pretty new to this. Thanx

Converting A DATE
Hello all,

I've got a problem when using the "FORMAT" method...

This is the date that I got -

Code:
and when using - Tmp_Date = CDate(Format(CDate("6/20/03 13:49:2"), "MM/DD/YYYY"))
I'm getting - 20/6/2003

Why ?

Thanks,
Eddie.

Converting Iso Date
Hi


How can I convert an iso date held in a string to a short date.

e.g.

sDate="2005-02-20"

I want to convert sDate to be "20/02/2005"

Thanks

Kati

Converting Date Help
VB Code:
Function Convert_Date_Int2Str(Date_Int As String) As String Select Case Date_Int  Case 1    Convert_Date_Int2Str = "January"  Case 2    Convert_Date_Int2Str = "February"  Case 3    Convert_Date_Int2Str = "March"  Case 4    Convert_Date_Int2Str = "April"  Case 5    Convert_Date_Int2Str = "May"  Case 6    Convert_Date_Int2Str = "June"  Case 7    Convert_Date_Int2Str = "July"  Case 8    Convert_Date_Int2Str = "August"  Case 9    Convert_Date_Int2Str = "September"  Case 10    Convert_Date_Int2Str = "October"  Case 11    Convert_Date_Int2Str = "November"  Case 12    Convert_Date_Int2Str = "December"End SelectEnd Function


Hi All
Im still working on my project here is another one for you all
when my program runs it accepts day , month, year from list boxes.
the boxes are text. Now i have to convert them to numbers uptop i only have the one for the month. Is there a easyer way????

Thanks Ed

Need Help Converting Date
Ok, I have to pull some data from an old database we have, and convert a field to a date. For example, 6750 is one date. This is 6750 days since Jan 1, 1980. Anyone know how I would convert this?? Thanks

Date Converting
I have a TextBox that accepts only 4 numbers before the user
can click the OK button.

And what do I want to do with this?

I want to check if the number entered in the TextBox is more
than 2 years away(lower) from the actual date's year

How can I do this?
How can I convert the TextBox.Text into
date format.

Converting Date To UTC GMT
hi,

I need to convert a dateTime (say, "1999 Jan 3 21:23:45") to UTC GMT.

is it possible in VB ?

I can get the number of seconds from midnight 1970 by :

Dim dtStartDate As Date
Dim dtEndDate As Date
dteStartDate = CDate("01 Jan 1970 00:00:00")
dteEndDate = CDate("01 Mar 1999 00:00:00")
MsgBox DateDiff("s", dteStartDate, dteEndDate)

But, before I do it I need to convert 'dteEndDate' to GMT.

I there a way to convert dateTime to GMT ?
** While considering the daylight savings at the dateTime !!

thanks in advance
-Srinivas.

Converting A String To A Variable
Hi,

I have an app which has many constants (all 3 figure numbers) these are all grouped into either A, B or C e.g.


Code:
public const intCustomerAName = 111
public const intCustomerBName = 222
public const intCustomerCName = 333

what I would like to do is to be able to refer to the constant I need by building a string e.g.


Code:
dim sID as string, sParam as string

sID = "A"

Param = "intCustomer" & sID & "Name"

however this isn't possible as it just creates a string with the same name as the constant I want to refer to. Is there any way of achieving this? I hope my explanation wasn't too poorly written!

Converting A Variable Name To A String
is there any way to extract the name of a varible?

i.e.

to get the name of a variable in string format

Dim Variable as Integer

Dim name as String

name = GetName(Variable) ;;; returns "Variable"

thanks

Help With Converting A String To A Variable Name
I am writing a program that needs to change the string into a variable name and vice versa.

For example:

The user enters the string "abc". The program will show what is store in the variable 'abc'.

Thanx

Converting From Date To Integer
I want to convert a date from date to integer format in VBA. (For example, If the date currently reads 11/29/02, I want it to read 112902)
I have tried using the following:

Left([Activity Date],2) & Mid([Activity Date],4,2) & Right([Activity Date],2)

But this only works when the date has two digits for the month and day (as in the example above), and I'm not really sure what to use if the date has one digit for either the month or day or both. (i.e. 1/25/02, or 1/5/02)
I don't have control over how the user inputs the data, so there is not always going to be 6 digits in the date for the above formula to work. I have tried changing the datatype in the design of the table from Date/Time to Integer, but this doesn't seem to work either. Is there any other way to do this?
Any help is greatly appreciated.
Thanks!

Converting Date To HEX Values?
Hey folks...I need to be able to convert a date into a HEX value. So far I have the following objects on my form :

1 - ComboBox (ComboMonths)
1 - ComboBox (TxtDays)
1 - ComboBox (ComboYears)
1 - Label (LblHEXDate)

How would I make it so that when the user choses his/her options, the LblHEXDate updates, showing the user the HEX Value for the chosen date?


For Example:

Case Scenario

ComboMonths = April
ComboDays = 26
ComboYears = 2003

Outcome

LblHEXDate would read : 87DA


Thanks in advance all. This one really baffles me as I have no idea how to convert anything into HEX data, much less take 3 seperate components and attempt to create one HEX string.

Cheers!
Fresh-Flesh

Converting One Date Format To Another?
I have a date in YY/MM/DD format and when I use CDate it mixes the day and year, how can I convert it from this YY/MM/DD format to a date format? Changing the YY/MM/DD format of the input date is not an option.

Thanks

Date Format(Converting)
Hai everybody,
I am getting date in "DD/MM/YYYY" format into a text box. Now i want to store that into a access table. What coding should i give for that. If i simply give fields(0).value=text1.text, then it takes the date in "MM/DD/YYYY" format, also it gives error for 23/25/2000. Also please help me to enter a null into the same date/time field.

Advance Thank X to all who helps me.

Converting The WMI Date Numbers
Using WMI I have extracted many different dates (install date, last reboot, etc) but the output is in this string format
20010523064436.000000-300

Has anyone ran across this and if so how did you convert it. Yes I do see the date and time in here but the rest is greek.

Converting Date To Number
I'm trying to take a date, say "6-16-2004", and convert it via VB or API function to a serial number (872348289) That I can later convert back into "6-16-2004" via VB or API function.

Why? I need to store a date as .ItemData

I tried searching, but I can't think of keywords to give me anything relevant. Anyone have a Google query I can use?



Edited by - Metallisoft on 6/18/2004 10:15:19 AM

Converting Variable String To Double
VB Code:
Dim a As StringDim b As Double A = Mid(strInput, 1 ,10)B = Val(Format(A, "0.00"))


y i cant do the convertion?

Converting A Date To Julian Format?
I need to convert a system Date to Julian format. Quick and simple question, how do I do it?

Converting Date &amp; Time Into Integer
I have created a database to work out Total Payment based on Pay per Hour and numbers of hours worked...

Pay per Hour = Integer
No. of Hours = Date & Time

The above are the formats used for rate of pay and no of hours.

I can't multiply them together as they are of towo different formats. So what I need to do is convert the No of hours into an Integer.. Can anyone please help me with this?

Thank you in advance

Edit: Sorry Rate of Pay is currency... not Integer. I still need to convert the No of Hours into an Integer though as I can't use Date & Time in caluculations..

Copyright 2005-08 www.BigResource.com, All rights reserved