Solved

format date

Posted on 2000-05-11
2
203 Views
Last Modified: 2006-11-17
how do i format a date variable so that it only displays hh:mm AM/PM?  I found a formatDateTime function but it only provides 5 different formats, none of which fit the format that I would like.

thanks
0
Comment
Question by:ueihp
2 Comments
 
LVL 6

Accepted Solution

by:
setiawan earned 50 total points
Comment Utility
Hi ueihp,

you can use datepart function and create your own format
here is some desc & examples:

Setting  Deskripsi
 yyyy      year
 q         quarter
 m         month
 y         day of year
 d         day
 w         weekday
 ww        week of year
 h         hour
 n         minute
 s         second

<%
' Function ini berguna untuk menampilkan
' nama bulan dalam bahasa Indonesia
function TampilBulan(b)
  bulan = array("Januari","Februari", "Maret", "April", _
    "Mei", "Juni", "Juli", "Agustus", "September", _
    "Oktober", "November", "Desember")
  TampilBulan = bulan(b)
end function

' Function ini berguna untuk menampilkan
' nama hari dalam bahasa Indonesia
function TampilHari(c)
  hari = array("Minggu", "Senin","Selasa","Rabu","Kamis",_
    "Jumat","Sabtu")
  TampilHari = hari(c)
end function

function FormatTanggal(tgl)
  s = TampilHari(DatePart("w",tgl)-1)
  s = s & " " &  DatePart("d", tgl)
  s = s & " " & TampilBulan(DatePart("m", tgl)-1)
  s = s & " " & DatePart("yyyy", tgl)
  FormatTanggal = s
end function
%>

<html>
<head>
<title>Tampilkan hari ini</title>
</head>

<body>
  <H4><%= FormatTanggal(now())%></H4>
</body>
</html>

   
  danny
0
 
LVL 7

Expert Comment

by:weesiong
Comment Utility
<%
response.write(Time)
%>
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now