SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    May 2006
    Location
    Australia, Melbourne
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    SetLocale and date Format

    Does any body knows how to change format for date using locale setings, I want format a long date as dd MMM YYYY (for example 12 Feb 2006).

    In my function I change current Locale to "Eng-gb" and
    'Set current locale as "Eng-gb" so date will have format "DD/MM/YYYY" and I want that long date will have format dd MMM YYYY (for example 12 Feb 2006).
    In my computer for Eng-gb I have long date set as Monday, 12 February 2006.

    myLocale = SetLocale("en-gb")
    'msgbox GetLocale

    mydate = CDate(Date)
    'msgbox mydate
    'Define new enviroment Value LongDate as today formated as "DD/MM/YYYY"
    Environment.Value("vShortDate") = myDate
    Monika

  2. #2
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: SetLocale and date Format

    Monika there's probably an easier way as I'm doing this from memory, but this works:

    myLocale = SetLocale("en-gb")
    x = CDate(Date)
    y=Split(x,"/")
    z = MonthName(y(1), True)
    y(1)=z
    myDate = y(0)&"/"&y(1)&"/"&y(2)
    MsgBox myDate

    Mark Smith.

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    London, U.K
    Posts
    1,804
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: SetLocale and date Format

    I find easiest way to format date is to use Excel TEXT function :

    Public Function FormatDate(Mydate,MyFormat)
    set oExcel = createobject("excel.application")
    FormatDate = oexcel.text(MyDate,MyFormat)
    Set OExcel = Nothing
    End Function

  4. #4
    Junior Member
    Join Date
    May 2006
    Location
    Australia, Melbourne
    Posts
    15
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: SetLocale and date Format

    Yes it works [img]/images/graemlins/smile.gif[/img]
    I only changed myDate = y(0)&" "&y(1)&" "&y(2) to receive date formatted as 12 Feb 2007

    Thanks
    Monika
    Monika

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:30 AM.

Copyright BetaSoft Inc.