È possibile effettuare confronti tra data e data corrente in un modello di un freemarker senza passare la data corrente nel modello?FreeMarker Current Date Comparison
6
A
risposta
-5
NO
Freemarker è una libreria di template, non c'è un variabile oggi.
Ma è possibile passare un oggetto Java new Date()
al modello.
18
Da FreeMarker 2.3.17 on è possibile utilizzare la nuova variabile speciale .now
:
[#assign foo = .now > yesterday?datetime]
Problemi correlati
- 1. Rails 3 DateTime Comparison w/Date In An ActiveRecord Query
- 2. data Nullable in Freemarker
- 3. JavaScript Node.js Data Comparison and Array ordina per Data
- 4. Compact Framework Current Folder
- 5. Ruby current class
- 6. Current Thread Method java
- 7. Magento - get current product
- 8. funzionalità Freemarker 'Collection.contains'
- 9. predefinito fuga in Freemarker
- 10. Commutazione enum in freemarker
- 11. FreeMarker? Sostituire più valori
- 12. Spring Boot e FreeMarker
- 13. E in freemarker
- 14. Velocity vs. FreeMarker
- 15. funzioni FreeMarker vs macro
- 16. spark sql current timestamp function
- 17. react router - get current route
- 18. PHP display current server path
- 19. Git - push current shortcut corrente
- 20. UITesting, XCTest current ViewController Class
- 21. HTML 5 Audio Current Position
- 22. iterazione di mappa in Freemarker
- 23. header and footer and freemarker
- 24. Utilizzare l'operatore ternario nel freemarker?
- 25. Elenco degli archi in Freemarker
- 26. Flussaggio testa HTML con freemarker
- 27. Gestione valori null in Freemarker
- 28. Codifica base64 in modello Freemarker
- 29. modello freemarker per istruzione loop
- 30. EntityTag - Value, Caching, Comparison - how to in Jersey
Si dovrebbe prendere in considerazione l'aggiornamento o l'eliminazione di questa risposta, come è ora corretta – juan
Beh, non ci dovrebbe essere una data corrente in linea di principio, ma era una richiesta così frequente, ".now" è stato aggiunto nonostante sia così sporco. – ddekany