tips & tricks


Calendario
aprile 2024
lmmgvsd
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Formattare le date con Jscript

 Avendo una data in Jscript per formattarla a mio piacimento posso creare una funzioncina che gioca con la concatenazione di stringhe:

 

function FormatDate(date,format)

{

    var formattedDate;

 

    if (format=="yyyy/MM/dd") formattedDate = data.getYear()+"/"+data.getMonth()+1+"/"+data.getDate();

    else if (format=="dd/MM/yyyy") formattedDate = data.getDate()+"/"+(data.getMonth()+1)+"/"+data.getYear();

 

    return formattedDate;

}



Nel CRM che c'è una funzione per formattare le date con il formato dell'utente corrente
: 

FormatDate(crmForm.all.[MyField].DataValue)

 

 dove [MyField] è un campo di tipo date

Categoria: Jscript
mercoledì, 28 gen 2009 Ore. 15.37
Archivio Posts
Anno 2020

Anno 2018

Anno 2015

Anno 2013

Anno 2011

Anno 2010

Anno 2009

Anno 2008
Statistiche
  • Views Home Page: 13.374
  • Views Posts: 56.172
  • Views Gallerie: 2.837
  • n° Posts: 117
  • n° Commenti: 1
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003