i need to use datediff to calculate the difference in minutes between Now()
and a date returned from a 3rd party object.

Now() returns the date as: "5/10/2007 7:15:42 PM"

my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"

datediff chokes on this. is there any way i can convert that ugly date to
one that datediff can use? please say yes and give me an example

:(

Re: date format problem by Bill

Bill
Thu May 10 20:37:47 CDT 2007

As long as the format of your date is consistent you should be able to =
parse it out quite easily. The last element appears to be an time =
offset, if you need to apply that then the conversion needs more work.

sDate =3D "Thu, 10 May 2007 19:13:09"

' Strip leading weekday and ending offset=20
sDate =3D Mid(sDate, InStr(sDate, " ") +1, InStrRev(sDate, " "))

' Test
msgbox datediff("n", Now(), sDate)

--=20

Bill James


"Mole Man" <m@m.m> wrote in message =
news:eT0Zbm1kHHA.568@TK2MSFTNGP02.phx.gbl...
>i need to use datediff to calculate the difference in minutes between =
Now()=20
> and a date returned from a 3rd party object.
>=20
> Now() returns the date as: "5/10/2007 7:15:42 PM"
>=20
> my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"
>=20
> datediff chokes on this. is there any way i can convert that ugly date =
to=20
> one that datediff can use? please say yes and give me an example
>=20
> :(
>

Re: date format problem by Mole

Mole
Fri May 11 04:41:38 CDT 2007

yup thatll work... thank you



"Bill James" <wgjames@mvps.org> wrote in message
news:OfI4%23z2kHHA.3472@TK2MSFTNGP04.phx.gbl...
As long as the format of your date is consistent you should be able to parse
it out quite easily. The last element appears to be an time offset, if you
need to apply that then the conversion needs more work.

sDate = "Thu, 10 May 2007 19:13:09"

' Strip leading weekday and ending offset
sDate = Mid(sDate, InStr(sDate, " ") +1, InStrRev(sDate, " "))

' Test
msgbox datediff("n", Now(), sDate)

--

Bill James


"Mole Man" <m@m.m> wrote in message
news:eT0Zbm1kHHA.568@TK2MSFTNGP02.phx.gbl...
>i need to use datediff to calculate the difference in minutes between Now()
> and a date returned from a 3rd party object.
>
> Now() returns the date as: "5/10/2007 7:15:42 PM"
>
> my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"
>
> datediff chokes on this. is there any way i can convert that ugly date to
> one that datediff can use? please say yes and give me an example
>
> :(
>


Re: date format problem by J

J
Fri May 11 10:52:19 CDT 2007

actually your code doesnt work.

date = Thu, 11 May 2007 11:05:22 -0400

your example didnt use the offset, and when its there it isnt removed






"Bill James" <wgjames@mvps.org> wrote in message
news:OfI4%23z2kHHA.3472@TK2MSFTNGP04.phx.gbl...
As long as the format of your date is consistent you should be able to parse
it out quite easily. The last element appears to be an time offset, if you
need to apply that then the conversion needs more work.

sDate = "Thu, 10 May 2007 19:13:09"

' Strip leading weekday and ending offset
sDate = Mid(sDate, InStr(sDate, " ") +1, InStrRev(sDate, " "))

' Test
msgbox datediff("n", Now(), sDate)

--

Bill James


"Mole Man" <m@m.m> wrote in message
news:eT0Zbm1kHHA.568@TK2MSFTNGP02.phx.gbl...
>i need to use datediff to calculate the difference in minutes between Now()
> and a date returned from a 3rd party object.
>
> Now() returns the date as: "5/10/2007 7:15:42 PM"
>
> my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"
>
> datediff chokes on this. is there any way i can convert that ugly date to
> one that datediff can use? please say yes and give me an example
>
> :(
>


Re: date format problem by J

J
Fri May 11 12:04:24 CDT 2007

this works:


Mid(strUglyDate, InStr(strUglyDate, " ") + 1, (InstrRev(strUglydate, " ") -
Instr(strUglydate, " ")) - 1)

assuming date is: Thu, 10 May 2007 19:13:09 -0400




"Bill James" <wgjames@mvps.org> wrote in message
news:OfI4%23z2kHHA.3472@TK2MSFTNGP04.phx.gbl...
As long as the format of your date is consistent you should be able to parse
it out quite easily. The last element appears to be an time offset, if you
need to apply that then the conversion needs more work.

sDate = "Thu, 10 May 2007 19:13:09"

' Strip leading weekday and ending offset
sDate = Mid(sDate, InStr(sDate, " ") +1, InStrRev(sDate, " "))

' Test
msgbox datediff("n", Now(), sDate)

--

Bill James


"Mole Man" <m@m.m> wrote in message
news:eT0Zbm1kHHA.568@TK2MSFTNGP02.phx.gbl...
>i need to use datediff to calculate the difference in minutes between Now()
> and a date returned from a 3rd party object.
>
> Now() returns the date as: "5/10/2007 7:15:42 PM"
>
> my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"
>
> datediff chokes on this. is there any way i can convert that ugly date to
> one that datediff can use? please say yes and give me an example
>
> :(
>


Re: date format problem by Bill

Bill
Fri May 11 16:57:31 CDT 2007

Well, it certainly worked for me and apparently for "Mole Man". As I =
pointed out in my remarks, the offset isn't allowed for in my example. =
But then, there was nothing in the original post to indicate that the =
offset needed to be applied.

--=20

Bill James


"J. Anos" <j@anos.com> wrote in message =
news:ehx4dQ%23kHHA.4768@TK2MSFTNGP05.phx.gbl...
> actually your code doesnt work.
>=20
> date =3D Thu, 11 May 2007 11:05:22 -0400
>=20
> your example didnt use the offset, and when its there it isnt removed
>=20
>=20
>=20
>=20
>=20
>=20
> "Bill James" <wgjames@mvps.org> wrote in message=20
> news:OfI4%23z2kHHA.3472@TK2MSFTNGP04.phx.gbl...
> As long as the format of your date is consistent you should be able to =
parse=20
> it out quite easily. The last element appears to be an time offset, =
if you=20
> need to apply that then the conversion needs more work.
>=20
> sDate =3D "Thu, 10 May 2007 19:13:09"
>=20
> ' Strip leading weekday and ending offset
> sDate =3D Mid(sDate, InStr(sDate, " ") +1, InStrRev(sDate, " "))
>=20
> ' Test
> msgbox datediff("n", Now(), sDate)
>=20
> --=20
>=20
> Bill James
>=20
>=20
> "Mole Man" <m@m.m> wrote in message=20
> news:eT0Zbm1kHHA.568@TK2MSFTNGP02.phx.gbl...
>>i need to use datediff to calculate the difference in minutes between =
Now()
>> and a date returned from a 3rd party object.
>>
>> Now() returns the date as: "5/10/2007 7:15:42 PM"
>>
>> my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"
>>
>> datediff chokes on this. is there any way i can convert that ugly =
date to
>> one that datediff can use? please say yes and give me an example
>>
>> :(
>>=20
>

Re: date format problem by Dr

Dr
Fri May 11 14:48:01 CDT 2007

In microsoft.public.scripting.vbscript message <eT0Zbm1kHHA.568@TK2MSFTN
GP02.phx.gbl>, Thu, 10 May 2007 19:19:04, Mole Man <m@m.m> posted:
>i need to use datediff to calculate the difference in minutes between
>Now() and a date returned from a 3rd party object.
>
>Now() returns the date as: "5/10/2007 7:15:42 PM"

No, it does not. It returns a CDate, which (alien terminology?) is a
Variant holding an IEEE Double of days, with 1899-12-30 00:00:00 LCT =
0.0.

When the VBS system performs a default conversion of a CDate to a CStr
string, it does so in accordance with OS settings. Currently I get
"2007-05-11 20:35:05". You are getting an FFF date, so presumably have
chosen or accepted settings preferred by the less thoughtful Americans.


>my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"

Presumably as a string. But is -0400 necessarily your own local offset,
or is it the offset at some other place where the date were originated?
You may need to correct that 19:13:09 to your own local time, with due
allowances for DST and the fact that even in the US DST does not change
everywhere simultaneously.

>datediff chokes on this. is there any way i can convert that ugly date
>to one that datediff can use? please say yes and give me an example


If you and your applications were to use the applicable international
standard to get date/time formats, you would not have all these
problems. The rest of us laugh at you people suffering for your own
follies, as a partial recompense for the troubles we expect and get when
using software originated in the USA.

Remove the redundant day-of-week; separate the offset; the remainder
will be accepted by CDate. Now correct that CDate by the difference
between the given offset and your current local one, if it may be non-
zero.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.

Re: date format problem by Mole

Mole
Sat May 12 07:42:31 CDT 2007

uh... did you not readt the part that said:

my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"

did you think i put it there for fun?




"Bill James" <wgjames@mvps.org> wrote in message
news:%23JWPidBlHHA.3496@TK2MSFTNGP03.phx.gbl...
Well, it certainly worked for me and apparently for "Mole Man". As I
pointed out in my remarks, the offset isn't allowed for in my example. But
then, there was nothing in the original post to indicate that the offset
needed to be applied.

--

Bill James


"J. Anos" <j@anos.com> wrote in message
news:ehx4dQ%23kHHA.4768@TK2MSFTNGP05.phx.gbl...
> actually your code doesnt work.
>
> date = Thu, 11 May 2007 11:05:22 -0400
>
> your example didnt use the offset, and when its there it isnt removed
>
>
>
>
>
>
> "Bill James" <wgjames@mvps.org> wrote in message
> news:OfI4%23z2kHHA.3472@TK2MSFTNGP04.phx.gbl...
> As long as the format of your date is consistent you should be able to
> parse
> it out quite easily. The last element appears to be an time offset, if
> you
> need to apply that then the conversion needs more work.
>
> sDate = "Thu, 10 May 2007 19:13:09"
>
> ' Strip leading weekday and ending offset
> sDate = Mid(sDate, InStr(sDate, " ") +1, InStrRev(sDate, " "))
>
> ' Test
> msgbox datediff("n", Now(), sDate)
>
> --
>
> Bill James
>
>
> "Mole Man" <m@m.m> wrote in message
> news:eT0Zbm1kHHA.568@TK2MSFTNGP02.phx.gbl...
>>i need to use datediff to calculate the difference in minutes between
>>Now()
>> and a date returned from a 3rd party object.
>>
>> Now() returns the date as: "5/10/2007 7:15:42 PM"
>>
>> my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"
>>
>> datediff chokes on this. is there any way i can convert that ugly date to
>> one that datediff can use? please say yes and give me an example
>>
>> :(
>>
>


Re: date format problem by Mole

Mole
Sat May 12 07:45:35 CDT 2007

pretty big attitude for a guy that lives in a place that still has a king
and queen

unfortunately for you, the US IS the king... so most likely youll have to
keep dealing with what we decide works best

:)




"Dr J R Stockton" <jrs@merlyn.demon.co.uk> wrote in message
news:XlebECgxhMRGFwK4@invalid.uk.co.demon.merlyn.invalid...
> In microsoft.public.scripting.vbscript message <eT0Zbm1kHHA.568@TK2MSFTN
> GP02.phx.gbl>, Thu, 10 May 2007 19:19:04, Mole Man <m@m.m> posted:
>>i need to use datediff to calculate the difference in minutes between
>>Now() and a date returned from a 3rd party object.
>>
>>Now() returns the date as: "5/10/2007 7:15:42 PM"
>
> No, it does not. It returns a CDate, which (alien terminology?) is a
> Variant holding an IEEE Double of days, with 1899-12-30 00:00:00 LCT =
> 0.0.
>
> When the VBS system performs a default conversion of a CDate to a CStr
> string, it does so in accordance with OS settings. Currently I get
> "2007-05-11 20:35:05". You are getting an FFF date, so presumably have
> chosen or accepted settings preferred by the less thoughtful Americans.
>
>
>>my object returns it as: "Thu, 10 May 2007 19:13:09 -0400"
>
> Presumably as a string. But is -0400 necessarily your own local offset,
> or is it the offset at some other place where the date were originated?
> You may need to correct that 19:13:09 to your own local time, with due
> allowances for DST and the fact that even in the US DST does not change
> everywhere simultaneously.
>
>>datediff chokes on this. is there any way i can convert that ugly date
>>to one that datediff can use? please say yes and give me an example
>
>
> If you and your applications were to use the applicable international
> standard to get date/time formats, you would not have all these
> problems. The rest of us laugh at you people suffering for your own
> follies, as a partial recompense for the troubles we expect and get when
> using software originated in the USA.
>
> Remove the redundant day-of-week; separate the offset; the remainder
> will be accepted by CDate. Now correct that CDate by the difference
> between the given offset and your current local one, if it may be non-
> zero.
>
> --
> (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE
> 6.
> Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links,
> acronyms
> PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see
> 00index.htm
> Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm
> etc.