![]() Returns number representing current time zone hours utime.day() ![]() Returns number representing current time zone minutes utime.hour() Returns number representing current time zone seconds utime.minute() Returns current time zone date and time as an array (together with timezone name can be used to instantiate new Utime) cond() Returns Javascript Date() instance utime.toArray() Returns date and time in current time zone as text in simplified ISO format utime.toDate() Returns number representing date and time utime.toString() ![]() Returns new instance of Utime with date and time in given by name timezone.Ĭallback is optional, its argument is a new instance of Utime utime.getValue() Clean instance of Utime contains "utc" zone which is also default until new zone will be registeres as default Utime.isRegistered(name)Ĭhecks if given time zone name is already registered utime.in(name, callback) Last parameter is optional and points a default time zone. Registers new time zone database with given name. PrintDateAndTime(ptTimeToShift.shiftWeeks(2)) ĪPI Utime.registerZone(name, timeZoneDatabase, defaultTimeZone) can be stored and used to create new utime instanceĬonst uaTimeArray = new Utime('ua', ) //date and time for given timezone can be provided in more readable array formĬonst plTimeArray = new Utime() //default time zone will be used - in this case "pl" PrintDateAndTime(uaTime) //will print current time in UkraineĬonst plTimeNumber = new Utime('pl', 4329474300000) //number represents date and time, can be retrieved by getValue() methodĬonsole.log(plTimeNumber.getValue()) //prints number representing date and time - eg. PrintDateAndTime(plTime) //will print current time in Poland Utime.registerZone('pl', pl, true) //true means this will be a default time zoneĬonsole.log(`= $ =`) Ĭonst plTime = new Utime('pl') //will create Utime with current time You can download timezone data from this repository:ĭownload desired timezones data, here we will use portuguese, polish and ukrainian zones. Javascript Date-Time minimalistic library Installation npm install utime -save
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |