/ Forside/ Teknologi / Udvikling / VB/Basic / Spørgsmål
Login
Glemt dit kodeord?
Brugernavn 

Kodeord  


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
Dato Format
Fra : ReneKoemler
Vist : 211 gange
20 point
Dato : 12-12-03 08:15

Hej,

en lille hurtig...

Jeg vil gerne sætte et andet dato/tids format på tidspunkt i dag får jeg mm/dd/yyyy hh:mm

Jeg vil gerne har en "dansk" formattering dd/mm/yy hh:mm

Jeg bruger "Now" (textbox.value = Now)

Jeg har prøvet hjælpen til vba i excel den skriver nogen med Long og Short dates der følger maskinens opsætning men ikke om hvorledes man tildeler dette format til et tidspunkt.

/rene

 
 
Kommentar
Fra : natmaden


Dato : 12-12-03 10:44

Datoformatet følger (såvit jeg husker) det format du har valgt i windows.
vb's hjælp giver dette:
Kode
Returns a Variant (String) containing an expression formatted according to instructions contained in a format expression.

Syntax

Format(expression[, format[, firstdayofweek[, firstweekofyear]]])

The Format function syntax has these parts:

Part   Description
expression   Required. Any valid expression.
format   Optional. A valid named or user-defined format expression.
firstdayofweek   Optional. A constant that specifies the first day of the week.
firstweekofyear   Optional. A constant that specifies the first week of the year.
Settings

The firstdayofweek argument has these settings:

Constant   Value   Description
vbUseSystem   0   Use NLS API setting.
VbSunday   1   Sunday (default)
vbMonday   2   Monday
vbTuesday   3   Tuesday
vbWednesday   4   Wednesday
vbThursday   5   Thursday
vbFriday   6   Friday
vbSaturday   7   Saturday
The firstweekofyear argument has these settings:

Constant   Value   Description
vbUseSystem   0   Use NLS API setting.
vbFirstJan1   1   Start with week in which January 1 occurs (default).
vbFirstFourDays   2   Start with the first week that has at least four days in the year.
vbFirstFullWeek   3   Start with the first full week of the year.
Remarks

To Format   Do This
Numbers   Use predefined named numeric formats or create user-defined numeric formats.
Dates and times   Use predefined named date/time formats or create user-defined date/time formats.
Date and time serial numbers   Use date and time formats or numeric formats.
Strings   Create your own user-defined string formats.
If you try to format a number without specifying format, Format provides functionality similar to the Str function, although it is internationally aware. However, positive numbers formatted as strings using Format don’t include a leading space reserved for the sign of the value; those converted using Str retain the leading space.
-------------------------
This example shows various uses of the Format function to format values using both named formats and user-defined formats. For the date separator (/), time separator (:), and AM/ PM literal, the actual formatted output displayed by your system depends on the locale settings on which the code is running. When times and dates are displayed in the development environment, the short time format and short date format of the code locale are used. When displayed by running code, the short time format and short date format of the system locale are used, which may differ from the code locale. For this example, English/U.S. is assumed.

MyTime and MyDate are displayed in the development environment using current system short time setting and short date setting.

Dim MyTime, MyDate, MyStr
MyTime = #17:04:23#
MyDate = #January 27, 1993#

' Returns current system time in the system-defined long time format.
MyStr = Format(Time, "Long Time")

' Returns current system date in the system-defined long date format.
MyStr = Format(Date, "Long Date")

MyStr = Format(MyTime, "h:m:s")   ' Returns "17:4:23".
MyStr = Format(MyTime, "hh:mm:ss AMPM")   ' Returns "05:04:23 PM".

MyStr = Format(MyDate, "dddd, mmm d yyyy")   ' Returns "Wednesday,
   ' Jan 27 1993".
' If format is not supplied, a string is returned.
MyStr = Format(23)   ' Returns "23".

' User-defined formats.
MyStr = Format(5459.4, "##,##0.00")   ' Returns "5,459.40".
MyStr = Format(334.9, "###0.00")   ' Returns "334.90".
MyStr = Format(5, "0.00%")   ' Returns "500.00%".
MyStr = Format("HELLO", "<")   ' Returns "hello".
MyStr = Format("This is it", ">")   ' Returns "THIS IS IT".

Mvh. Natmaden

Kommentar
Fra : ReneKoemler


Dato : 12-12-03 10:46

Hej Natmand,

TNX - Jeg ´kigger på det

Kommentar
Fra : Rosco40


Dato : 26-09-05 16:20

txtDato.Text = Format(Now, "dd-mm-yyyy hh:mm")

Kommentar
Fra : natmaden


Dato : 15-02-06 05:48



Du har følgende muligheder
Dette spørgsmål er blevet annulleret, det er derfor ikke muligt for at tilføje flere kommentarer.
Søg
Reklame
Statistik
Spørgsmål : 173636
Tips : 31664
Nyheder : 719565
Indlæg : 6383614
Brugere : 218258

Månedens bedste
Årets bedste
Sidste års bedste