Format datetime

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JC Voon

    Format datetime

    hi:


    Is there a function to format the datetime value to the following
    format 2005-09-29T17:57:03.000 0000+08:00 ?

    currently i'm using a hard way


    Dim result As String
    Dim offset As Long

    result =
    Format(value,Da teTimeFormatInf o.CurrentInfo.S ortableDateTime Pattern)

    offset = TimeZone.Curren tTimeZone.GetUt cOffset(value). Ticks

    result &= CStr(IIf(offset < 0, "-", "+")) & _
    Format(New DateTime(offset ), "hh:mm")

    Thanks
    JCVoon


  • Ken Tucker [MVP]

    #2
    Re: Format datetime

    Hi,

    Take a look at the zzz format



    Ken
    ----------------------
    "JC Voon" <jcvoon_99@yaho o.com> wrote in message
    news:433bc642.3 6352942@msnews. microsoft.com.. .[color=blue]
    > hi:
    >
    >
    > Is there a function to format the datetime value to the following
    > format 2005-09-29T17:57:03.000 0000+08:00 ?
    >
    > currently i'm using a hard way
    >
    >
    > Dim result As String
    > Dim offset As Long
    >
    > result =
    > Format(value,Da teTimeFormatInf o.CurrentInfo.S ortableDateTime Pattern)
    >
    > offset = TimeZone.Curren tTimeZone.GetUt cOffset(value). Ticks
    >
    > result &= CStr(IIf(offset < 0, "-", "+")) & _
    > Format(New DateTime(offset ), "hh:mm")
    >
    > Thanks
    > JCVoon
    >
    >[/color]


    Comment

    • jcvoon

      #3
      Re: Format datetime

      Ken Tucker:

      Thanks.

      Now.ToString(Da teTimeFormatInf o.CurrentInfo.S ortableDateTime Pattern &
      "zzz")

      JCVoon

      Comment

      Working...