Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page