Filehost.ro - gazduire fisiere
Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Nou pe simpatie:
Stefania23 pe Simpatie.ro
Femeie
24 ani
Dolj
cauta Barbat
25 - 46 ani
Mrrrr's Forum (VIEW ONLY)ReguliInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides /

[VBS] Working With Dates

Pagini: 1 Moderat de TRaP, TonyTzu
#1
TRaP
Moderator
Postari: 960
dte = FormatDateTime(Now(), 2)
returns the current date as per your regional formatting (eg. 03/14/2023), in my case: 14.03.2023

Options for the 2nd argument:

    0 = vbGeneralDate - Default. Returns date: mm/dd/yyyy and time if specified: hh:mm:ss PM/AM.
    1 = vbLongDate - Returns date: weekday, monthname, year
    2 = vbShortDate - Returns date: mm/dd/yyyy
    3 = vbLongTime - Returns time: hh:mm:ss PM/AM
    4 = vbShortTime - Return time: hh:mm

Source:
https://www.w3schools.com/asp/func_formatdatetime.asp


 
   
#2
TRaP
Moderator
Postari: 960
Format the date the way you want, for example format today's date as: 2023-03-14


    d = Day(Now())
    If Len(d) = 1 Then
        d = "0" & Day(Now())
    End If
   
    m = Month(Now())
    If Len(m) = 1 Then
        m = "0" & Month(Now())
    End If

    y = Year(Now())
   
    strDate = y & "-" & m & "-" & d


Source:
https://stackoverflow.com/questions/900 ... ormat-date


 
   
#3
TRaP
Moderator
Postari: 960
TBA more

https://www.mikesdotnetting.com/article ... n-vbscript
https://www.softwaretestinghelp.com/vbs ... 8/#4_Month
https://www.devguru.com/content/technol ... hname.html


 
   
#4
TRaP
Moderator
Postari: 960
For hour, minute and second:


Hour(Now)
Minute(Now)
Second(Now)


 
   
Pagini: 1  
Mergi la