Somehow 437432903.96807599067687988281 translates to November 11, 2014, 4:08pm, but I'm not sure how.
Edit: The context is I'm trying to export data from Thyme, a menubar timer for Mac. It's recorded in an XML file called storedata. For example:
<object type="SESSION" id="z102">
<attribute name="seconds" type="int32">43</attribute>
<attribute name="minutes" type="int32">10</attribute>
<attribute name="hours" type="int32">4</attribute>
<attribute name="date" type="date">437432903.96807599067687988281</attribute>
</object>
Apple's OS X Objective C application framework Cocoa has a date/time class NSDate which uses an epoch date of January 1st 2001. So a timestamp of 437432903.96807599067687988281 seconds, when added to January 1st 2001, gives you the correct date and time: 9:08:23 pm GMT | Tuesday, November 11, 2014
Related
Using Blazor date input how can you disable future dates from the current date and also disable dates 1 month or more before the current date? But display the current date when page loads.
I'm using Blazor-Server-Side.
So far I have the razor page set like this:
<InputDate #bind-Value="viewmodel.Date" class="form-control" id="date"></InputDate>
<label> The date </label>
<ValidationMessage For="() => viewmodel.Date" />
And the model like this:
[Required(ErrorMessage = "Select the date")]
public DateTime Date { get; set; } = DateTime.Now;
I have tried 'max' attribute in the input tag to leave an end date but it did not work. I could not find a method to do this. Please let me know how I can solve this in Balzor or if there are other ways to achieve the same results? I would prefer if no jquery was used.
Thanks for your help.
If you are happy to do it in the markup, you can use min and max
<input type="date" min="2021-11-01" max="2022-01-31"/>
This example restricts to dates between 1st November 2021 and 31st Jan 2022 - the format yyyy-MM-dd is important in min/max.
You can use variables for the dates in Blazor, but make sure to format them using yyyy-MM-dd.
<InputDate #bind-Value="viewmodel.Date"
class="form-control"
id="date"
min=#DateTime.Today.AddMonths(-1).ToString("yyyy'-'MM'-'dd")
max=#DateTime.Today.ToString("yyyy'-'MM'-'dd")
/>
Blazor Repl - Working Sample
This question already has answers here:
Format Date output in JSF
(3 answers)
Closed 5 years ago.
I have a form and when inserting the data the date is inserted in the database in this format :
2017-04-01 00:00:00.0
Here is the component for inserting date into database
<p:outputLabel for="dateFin" value="Date fin"/>
<p:calendar id="dateFin" value="#{etpBean.dateFin}" required="true">
</p:calendar>
here is my component
<p:outputLabel for="dateDebut" value="Date Debut"/>
<p:calendar id="dateDebut" value="#{etpBean.dateDebut}" required="true">
<p:ajax event="dateSelect" listener="#{etpBean.onDateDebutChange}"/>
</p:calendar>
And in this form for search by date and is the same component, then When i chose the date to do the search by date and i display it in my bean it is in this format
Sun Apr 30 00:00:00 GMT 2017
So the list that I recover from the database and always empty since it is not the same format
You are a little bit confused. The date does not change just its appearance. The <p:calendar> has its (maybe local dependent) format and it should differ from the one applied when you visualize it in another view. The visual format of the TTimeStemp values may be set by <f:convertDateTime> subtags:
<h:inputText value="#{bean.date}">
<f:convertDateTime pattern="MM/dd/yyyy" />
</h:inputText>
<p:calendar value="#{bean.date}">
<f:convertDateTime pattern="MM/dd/yyyy" />
</p:calendar>
jsf 2 glassfish 4 primefaces 5.1
i am using the f:convertDateTime to convert the way date is shown but its showing the wrong date.
when i normally show the date it shows
Sat Jan 01 00:00:00 AST 2011
which is correct but its not what i want to show
so i am using <f:convertDateTime dateStyle="short"></f:convertDateTime> but instead of showing
01/01/11
its giving me
31/12/10
i tried using <f:convertDateTime pattern="MM/dd/yyyy"></f:convertDateTime> but that also gives me
12/31/2010
instead of
01/01/2011
<p:column headerText="Installation Date"
filterBy="#{w.installationDate}"
filterMatchMode="contains"
sortBy="#{w.installationDate}">
<h:outputText value="#{w.installationDate}" >
<f:convertDateTime pattern="MM/dd/yyyy"></f:convertDateTime>
</h:outputText>
</p:column>
Try adding this to your web.xml
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
I have scheduled task in JBoss:
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.varia.scheduler.Scheduler" name="acme:service=Scheduler">
<attribute name="...">...</attribute>
.....
</mbean>
</server>
How to write this task, that will execute at 1:00 AM on the first day of every month?
Thank You!
You'll need to create a scheduling class. org.jboss.varia.scheduler.Scheduler
Since you want to perform monthly and cannot state this as a attribute. You'll need to have another Class which handles setting the next interval. Java Monthly Timer
Have the scheduler class call the monthly timer to get the next interval and set it. Maybe pass some values at initial start.
<mbean code="org.jboss.varia.scheduler.Scheduler"
name="jboss.docs:service=Scheduler">
<attribute name="StartAtStartup">true</attribute>
<attribute name="SchedulableClass">org.jboss.book.misc.ex2.ExSchedulable</attribute>
<attribute name="SchedulableArguments">01:00</attribute> <!-- 24hr time hh:mm -->
<attribute name="SchedulableArgumentTypes">java.lang.String</attribute>
</mbean>
ExSchedulable (this is just pseudo-code)
public ExSchedulable(String time) {
Date tDate = new Date();
tDate.setTime(time);
Monthly monthyObj = Monthly(1); //Day of the month
//Gets the next interval date specified from the day of the month
Date nextInterval = monthyObj .getNextInterval(tDate);
}
I'm using RaptureXML to parse an rss feed from USGS. I am able to parse it just fine except the three tags of the same name. So, how do I get the 51.50 km from tag in this xml.
<item>
<pubDate>Thu, 12 Jan 2012 01:40:05 GMT</pubDate>
<title>M 4.7, near the east coast of Honshu, Japan</title>
<description>January 12, 2012 01:40:05 GMT</description>
<link>
http://earthquake.usgs.gov/earthquakes/recenteqsww/Quakes/usc0007jgs.php
</link>
<geo:lat>36.3774</geo:lat>
<geo:long>141.2328</geo:long>
<dc:subject>4</dc:subject>
<dc:subject>pasthour</dc:subject>
<dc:subject>51.50 km</dc:subject>
<guid isPermaLink="false">usc0007jgs</guid>
</item>