If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Convert Text To Valid Date
I have text field of [Yr] and [mth] and sample records as follow
[Yr] [mth] 2010 01 2010 02 How to convert the two fields as a valid year & month date Thanks |
#2
|
|||
|
|||
Convert Text To Valid Date
hi,
On 20.04.2010 12:17, zyus wrote: I have text field of [Yr] and [mth] and sample records as follow [Yr] [mth] 2010 01 2010 02 How to convert the two fields as a valid year& month date SELECT DateSerial([Yr], [mth], 1) As SampleDate, * FROM yourTable mfG -- stefan -- |
#3
|
|||
|
|||
Convert Text To Valid Date
On Tue, 20 Apr 2010 03:17:01 -0700, zyus
wrote: I have text field of [Yr] and [mth] and sample records as follow [Yr] [mth] 2010 01 2010 02 How to convert the two fields as a valid year & month date Thanks Note that a Date/Time field *always* contains a complete date, including a day: there's no such thing as a "year and month date". The Date/Time value is actually stored as a number, a count of days and fractions of a day (times) since midnight, December 30, 1899. As such it corresponds to a precise instant of time. January 2010 was not a precise instant of time, it was a whole bunch of them (some pleasant instants, some irritating....). Stefan's DateSerial expression will give you a date, arbitrarily picking midnight at the beginning of the first day of the month; but if you only display the year and month of the date, you should be OK. -- John W. Vinson [MVP] |
#4
|
|||
|
|||
Convert Text To Valid Date
Hi John,
Can i use Stefan's date serial expression with below expression that you have suggested before on special tagging. I want to include a valid date (month & Year) TblTag: IIf(Val([month])-Val(DMax("[MONTH]","Qunionall"))=0,"Current Month","Previous Month") "John W. Vinson" wrote: On Tue, 20 Apr 2010 03:17:01 -0700, zyus wrote: I have text field of [Yr] and [mth] and sample records as follow [Yr] [mth] 2010 01 2010 02 How to convert the two fields as a valid year & month date Thanks Note that a Date/Time field *always* contains a complete date, including a day: there's no such thing as a "year and month date". The Date/Time value is actually stored as a number, a count of days and fractions of a day (times) since midnight, December 30, 1899. As such it corresponds to a precise instant of time. January 2010 was not a precise instant of time, it was a whole bunch of them (some pleasant instants, some irritating....). Stefan's DateSerial expression will give you a date, arbitrarily picking midnight at the beginning of the first day of the month; but if you only display the year and month of the date, you should be OK. -- John W. Vinson [MVP] . |
#5
|
|||
|
|||
Convert Text To Valid Date
On Tue, 20 Apr 2010 17:54:02 -0700, zyus
wrote: Hi John, Can i use Stefan's date serial expression with below expression that you have suggested before on special tagging. I want to include a valid date (month & Year) TblTag: IIf(Val([month])-Val(DMax("[MONTH]","Qunionall"))=0,"Current Month","Previous Month") Stefan's expression will return a valid date/time value. You can use it wherever you would use a date/time value. If [month] in the above is in fact a date/time, then yes, you can replace [month] with the expression. -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|