For Programmers: Free Programming Magazines  


Home > Archive > MSDN > November 2004 > Formatting time and date strings...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Formatting time and date strings...
Malakie

2004-11-26, 3:55 pm

Hi all:

I am trying to create a string using both time and date however I want to do
it WITHOUT the punctuation!

Example, normally time and date would look like: 23:32:12 11/27/2004

But I want: 23321211272004 as my result.

Been working on this one a bit and for some reason my brain is just not
functioning right. Any help on this?

--
Take it light....

Malakie
Malakie@Hotmail.com



Rick Rothstein

2004-11-26, 3:55 pm

> I am trying to create a string using both time and date however I want
to do
> it WITHOUT the punctuation!
>
> Example, normally time and date would look like: 23:32:12 11/27/2004
>
> But I want: 23321211272004 as my result.
>
> Been working on this one a bit and for some reason my brain is just

not
> functioning right. Any help on this?


Try this

YourDateVariable = "23:32:12 1/27/2004"
CollapsedDate = Format(YourDateVariable, "hhnnssmmddyyyy")

Rick - MVP

Malakie

2004-11-26, 3:55 pm

Hi all:

You know, it is just one of those days.... DUH! Of course after posting my
brain had a moment of clarity... I was forgetting to use quotes in the
format string!

For those who may need this someday as well...

Here is what I was doing: format(Time, hhmmss) & format(Date, mmddyyyy)

when it should have been: format(Time, "hhmmss") & format(Date, "mmddyyyy")

anyhow, back to work..
--
Take it light....

Malakie
Malakie@Hotmail.com


"Malakie" <Malakie_NOSPAM@NOSPAM_Hotmail.com> wrote in message
news:eG$nmx%230EHA.2196@TK2MSFTNGP14.phx.gbl...
> Hi all:
>
> I am trying to create a string using both time and date however I want to
> do it WITHOUT the punctuation!
>
> Example, normally time and date would look like: 23:32:12 11/27/2004
>
> But I want: 23321211272004 as my result.
>
> Been working on this one a bit and for some reason my brain is just not
> functioning right. Any help on this?
>
> --
> Take it light....
>
> Malakie
> Malakie@Hotmail.com
>
>
>



Malakie

2004-11-26, 3:55 pm

Hi Rick:

Thanks.. my brain started up again shortly after posting.. I used the long
method since I am not having a good day when it comes to thinking... I went
with:

format(time, "hhmmss") & format(date,"mmddyyyy")

Obviously, I am still out of it... I need to change that to your example
which is what it should be. *sigh*

--
Take it light....

Malakie
Malakie@Hotmail.com


"Rick Rothstein" <rickNOSPAMnews@NOSPAMcomcast.net> wrote in message
news:OMCX04%230EHA.3908@TK2MSFTNGP12.phx.gbl...
> to do
> not
>
> Try this
>
> YourDateVariable = "23:32:12 1/27/2004"
> CollapsedDate = Format(YourDateVariable, "hhnnssmmddyyyy")
>
> Rick - MVP
>



Norm Cook

2004-11-27, 3:55 pm

If you just want a long hard to understand number to represent a date/time
try

dim dbl as double,d as date
d=now
debug.print d
dbl=cdbl(d)
debug.print dbl
debug.print cdate(dbl)

"Malakie" <Malakie_NOSPAM@NOSPAM_Hotmail.com> wrote in message
news:eG$nmx%230EHA.2196@TK2MSFTNGP14.phx.gbl...
> Hi all:
>
> I am trying to create a string using both time and date however I want to

do
> it WITHOUT the punctuation!
>
> Example, normally time and date would look like: 23:32:12 11/27/2004
>
> But I want: 23321211272004 as my result.
>
> Been working on this one a bit and for some reason my brain is just not
> functioning right. Any help on this?
>
> --
> Take it light....
>
> Malakie
> Malakie@Hotmail.com
>
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com