Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Date Format

Discussion in 'Information Technology' started by Zanstemic, Jul 28, 2006.

Tags:
  1. Zanstemic

    Zanstemic
    Expand Collapse
    Guest

    I'm looking to create the following data format and can use some help with an
    approach to solving the problem.

    060502

    With the 06 = year, 05 = month and 02 = day

    I've tried the DatePart function but it returns 2006 for the year, 5 for the
    month and 2 for the day.

    Any suggestions?
     
  2. Loading...


  3. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Format(YourDateField, "yymmdd")

    That will return a string. If you need it to be a number, use

    CLng(Format(YourDateField, "yymmdd"))

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Zanstemic" <Zanstemic@discussions.microsoft.com> wrote in message
    news:A128A1CC-B5D5-4372-BC6D-5130E5D6FCF9@microsoft.com...
    > I'm looking to create the following data format and can use some help with

    an
    > approach to solving the problem.
    >
    > 060502
    >
    > With the 06 = year, 05 = month and 02 = day
    >
    > I've tried the DatePart function but it returns 2006 for the year, 5 for

    the
    > month and 2 for the day.
    >
    > Any suggestions?
     
  4. Jerry Whittle

    Jerry Whittle
    Expand Collapse
    Guest

    Format(YourDateField, "yymmdd")
    --
    Jerry Whittle
    Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

    "Zanstemic" wrote:

    > I'm looking to create the following data format and can use some help with an
    > approach to solving the problem.
    >
    > 060502
    >
    > With the 06 = year, 05 = month and 02 = day
    >
    > I've tried the DatePart function but it returns 2006 for the year, 5 for the
    > month and 2 for the day.
    >
    > Any suggestions?
     
  5. Joseph Meehan

    Joseph Meehan
    Expand Collapse
    Guest

    Douglas J Steele wrote:
    > Format(YourDateField, "yymmdd")
    >
    > That will return a string. If you need it to be a number, use
    >
    > CLng(Format(YourDateField, "yymmdd"))


    Wouldn't that give a result of 60502?

    >
    >
    > "Zanstemic" <Zanstemic@discussions.microsoft.com> wrote in message
    > news:A128A1CC-B5D5-4372-BC6D-5130E5D6FCF9@microsoft.com...
    >> I'm looking to create the following data format and can use some
    >> help with an approach to solving the problem.
    >>
    >> 060502
    >>
    >> With the 06 = year, 05 = month and 02 = day
    >>
    >> I've tried the DatePart function but it returns 2006 for the year, 5
    >> for the month and 2 for the day.
    >>
    >> Any suggestions?


    --
    Joseph Meehan

    Dia duit
     
  6. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    You're correct, Joseph.

    While the format statement would result in 060502, converting it to a number
    would result in 60502.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "Joseph Meehan" <sligojoe_Spamno@hotmail.com> wrote in message
    news:FPHlg.76097$YI5.316@tornado.ohiordc.rr.com...
    > Douglas J Steele wrote:
    >> Format(YourDateField, "yymmdd")
    >>
    >> That will return a string. If you need it to be a number, use
    >>
    >> CLng(Format(YourDateField, "yymmdd"))

    >
    > Wouldn't that give a result of 60502?
    >
    >>
    >>
    >> "Zanstemic" <Zanstemic@discussions.microsoft.com> wrote in message
    >> news:A128A1CC-B5D5-4372-BC6D-5130E5D6FCF9@microsoft.com...
    >>> I'm looking to create the following data format and can use some
    >>> help with an approach to solving the problem.
    >>>
    >>> 060502
    >>>
    >>> With the 06 = year, 05 = month and 02 = day
    >>>
    >>> I've tried the DatePart function but it returns 2006 for the year, 5
    >>> for the month and 2 for the day.
    >>>
    >>> Any suggestions?

    >
    > --
    > Joseph Meehan
    >
    > Dia duit
    >
     
  7. Joseph Meehan

    Joseph Meehan
    Expand Collapse
    Guest

    Douglas J. Steele wrote:
    > You're correct, Joseph.
    >
    > While the format statement would result in 060502, converting it to a
    > number would result in 60502.


    I should point out that the number 60502 can be formatted when displayed
    to display as 060502

    >
    >
    > "Joseph Meehan" <sligojoe_Spamno@hotmail.com> wrote in message
    > news:FPHlg.76097$YI5.316@tornado.ohiordc.rr.com...
    >> Douglas J Steele wrote:
    >>> Format(YourDateField, "yymmdd")
    >>>
    >>> That will return a string. If you need it to be a number, use
    >>>
    >>> CLng(Format(YourDateField, "yymmdd"))

    >>
    >> Wouldn't that give a result of 60502?
    >>
    >>>
    >>>
    >>> "Zanstemic" <Zanstemic@discussions.microsoft.com> wrote in message
    >>> news:A128A1CC-B5D5-4372-BC6D-5130E5D6FCF9@microsoft.com...
    >>>> I'm looking to create the following data format and can use some
    >>>> help with an approach to solving the problem.
    >>>>
    >>>> 060502
    >>>>
    >>>> With the 06 = year, 05 = month and 02 = day
    >>>>
    >>>> I've tried the DatePart function but it returns 2006 for the year,
    >>>> 5 for the month and 2 for the day.
    >>>>
    >>>> Any suggestions?

    >>
    >> --
    >> Joseph Meehan
    >>
    >> Dia duit


    --
    Joseph Meehan

    Dia duit
     

Share This Page